本文整理汇总了Java中com.intellij.util.cls.ClsUtil.CONSTANT_Class方法的典型用法代码示例。如果您正苦于以下问题:Java ClsUtil.CONSTANT_Class方法的具体用法?Java ClsUtil.CONSTANT_Class怎么用?Java ClsUtil.CONSTANT_Class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.cls.ClsUtil
的用法示例。
在下文中一共展示了ClsUtil.CONSTANT_Class方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQualifiedName
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
public String getQualifiedName() throws ClsFormatException {
if (myQualifiedName == null) {
BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd() + 2);
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
int tag = ClsUtil.readU1(ptr);
if (tag != ClsUtil.CONSTANT_Class){
throw new ClsFormatException();
}
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
myQualifiedName = ClsUtil.readUtf8Info(ptr, '/', '.'); // keep '$' in the names
}
return myQualifiedName;
}
示例2: parseConstantPool
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
private void parseConstantPool() throws ClsFormatException {
if (myReferences != null) {
return;
}
myReferences = new ArrayList<ReferenceInfo>();
initConstantPool();
final BytePointer ptr = new BytePointer(getData(), 0);
ConstantPoolIterator iterator = new ConstantPoolIterator(ptr);
while (iterator.hasMoreEntries()) {
final int tag = ClsUtil.readU1(ptr);
if (tag == ClsUtil.CONSTANT_Fieldref || tag == ClsUtil.CONSTANT_Methodref || tag == ClsUtil.CONSTANT_InterfaceMethodref) {
//ptr.offset -= 1; // position to the beginning of the structure
MemberReferenceInfo refInfo = readRefStructure(tag, ptr);
if (refInfo != null) {
myReferences.add(refInfo);
}
/*
String name = mySymbolTable.getSymbol(refInfo.getMemberInfo().getName());
if (name.indexOf('$') < 0 && name.indexOf('<') < 0) { // skip refs to synthetic members
myReferences.add(refInfo);
}
else if ("<init>".equals(name)) { // add instance initializers (constructors)
myReferences.add(refInfo);
}
else {
System.out.println("ReferenceInfo thrown out: " + mySymbolTable.getSymbol(refInfo.getClassName()) + "." + mySymbolTable.getSymbol(refInfo.getMemberInfo().getName()));
ourWasteReferenceObjectsCounter += 1;
}
*/
}
else if (tag == ClsUtil.CONSTANT_Class) {
ptr.offset -= 1; // position to the beginning of the structure
String className = readClassInfo(ptr);
myReferences.add(new ReferenceInfo(getSymbolId(className)));
}
iterator.next();
}
//System.out.println("ourWasteReferenceObjectsCounter = " + ourWasteReferenceObjectsCounter);
}
示例3: readRefStructure
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
private MemberReferenceInfo readRefStructure(int tag, BytePointer ptr) throws ClsFormatException {
/*
if (tag != ClsUtil.CONSTANT_Fieldref && tag != ClsUtil.CONSTANT_Methodref && tag != ClsUtil.CONSTANT_InterfaceMethodref) {
throw new ClsFormatException();
}
*/
int classInfoIndex = ClsUtil.readU2(ptr);
int nameTypeInfoIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(classInfoIndex);
if (ClsUtil.CONSTANT_Class != ClsUtil.readU1(ptr)) {
throw new ClsFormatException();
}
ptr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
String className = ClsUtil.readUtf8Info(ptr, '/', '.'); // keep '$' in names
ptr.offset = getOffsetInConstantPool(nameTypeInfoIndex);
if (ClsUtil.CONSTANT_NameAndType != ClsUtil.readU1(ptr)) {
throw new ClsFormatException();
}
int memberNameIndex = ClsUtil.readU2(ptr);
int descriptorIndex = ClsUtil.readU2(ptr);
ptr.offset = getOffsetInConstantPool(memberNameIndex);
String memberName = ClsUtil.readUtf8Info(ptr);
if ((memberName.indexOf('$') >= 0 || memberName.indexOf('<') >= 0) && !CONSTRUCTOR_NAME.equals(memberName)) { // skip refs to synthetic members
return null;
}
ptr.offset = getOffsetInConstantPool(descriptorIndex);
String descriptor = ClsUtil.readUtf8Info(ptr);
MemberInfo info = ClsUtil.CONSTANT_Fieldref == tag? new FieldInfo(getSymbolId(memberName), getSymbolId(descriptor)) : new MethodInfo(getSymbolId(memberName), getSymbolId(descriptor), CONSTRUCTOR_NAME.equals(memberName));
return new MemberReferenceInfo(getSymbolId(className), info);
}
示例4: readClassInfo
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
private String readClassInfo(BytePointer ptr) throws ClsFormatException{
final int tag = ClsUtil.readU1(ptr);
if (tag != ClsUtil.CONSTANT_Class){
throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.record.tag.expected.another", tag, ClsUtil.CONSTANT_Class));
}
int index = ClsUtil.readU2(ptr);
return ClsUtil.readUtf8Info(new BytePointer(ptr.bytes, getOffsetInConstantPool(index)), '/', '.');
}
示例5: readAnnotationClassName
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
private String readAnnotationClassName(BytePointer ptr) throws ClsFormatException {
// TODO: need this method because because of incomplete class format spec at the moment of writing
// it is not clear what structure is expected: CONSTANT_Utf8 or CONSTANT_Class
final int tag = ClsUtil.readU1(ptr);
if (tag == ClsUtil.CONSTANT_Utf8) {
return ClsUtil.getTypeText(ptr.bytes, ptr.offset + 2); //skip length
}
if (tag == ClsUtil.CONSTANT_Class){
ptr.offset -= 1; // rollback
return readClassInfo(ptr);
}
//noinspection HardCodedStringLiteral
throw new ClsFormatException(CompilerBundle.message("class.parsing.error.wrong.record.tag.expected.another", tag, "CONSTANT_Utf8(" + ClsUtil.CONSTANT_Utf8 + ") / CONSTANT_Class(" + ClsUtil.CONSTANT_Class + ")"));
}
示例6: next
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
/**
* Positions the pointer to the next entry
*/
public void next() throws ClsFormatException {
myPtr.offset = myCurrentOffset;
int tag = ClsUtil.readU1(myPtr);
switch(tag){
default:
throw new ClsFormatException();
case ClsUtil.CONSTANT_Class:
case ClsUtil.CONSTANT_String:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_Fieldref:
case ClsUtil.CONSTANT_Methodref:
case ClsUtil.CONSTANT_InterfaceMethodref:
case ClsUtil.CONSTANT_Integer:
case ClsUtil.CONSTANT_Float:
case ClsUtil.CONSTANT_NameAndType:
myPtr.offset += 4;
break;
case ClsUtil.CONSTANT_Long:
case ClsUtil.CONSTANT_Double:
myPtr.offset += 8;
myCurrentEntryIndex++; // takes 2 entries
break;
case ClsUtil.CONSTANT_Utf8:
int length = ClsUtil.readU2(myPtr);
myPtr.offset += length;
break;
case ClsUtil.CONSTANT_MethodHandle:
myPtr.offset += 3;
break;
case ClsUtil.CONSTANT_MethodType:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_InvokeDynamic:
myPtr.offset += 4;
break;
}
myCurrentEntryIndex++;
myCurrentOffset = myPtr.offset;
}
示例7: next
import com.intellij.util.cls.ClsUtil; //导入方法依赖的package包/类
/**
* Positions the pointer to the next entry
*/
public void next() throws ClsFormatException {
myPtr.offset = myCurrentOffset;
int tag = ClsUtil.readU1(myPtr);
switch(tag){
default:
throw new ClsFormatException();
case ClsUtil.CONSTANT_Class:
case ClsUtil.CONSTANT_String:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_Fieldref:
case ClsUtil.CONSTANT_Methodref:
case ClsUtil.CONSTANT_InterfaceMethodref:
case ClsUtil.CONSTANT_Integer:
case ClsUtil.CONSTANT_Float:
case ClsUtil.CONSTANT_NameAndType:
myPtr.offset += 4;
break;
case ClsUtil.CONSTANT_Long:
case ClsUtil.CONSTANT_Double:
myPtr.offset += 8;
myCurrentEntryIndex++; // takes 2 entries
break;
case ClsUtil.CONSTANT_Utf8:
int length = ClsUtil.readU2(myPtr);
myPtr.offset += length;
break;
case ClsUtil.CONSTANT_MethodHandle:
myPtr.offset += 3;
break;
case ClsUtil.CONSTANT_MethodType:
myPtr.offset += 2;
break;
case ClsUtil.CONSTANT_InvokeDynamic:
myPtr.offset += 4;
break;
}
myCurrentEntryIndex++;
myCurrentOffset = myPtr.offset;
}