当前位置: 首页>>代码示例>>Java>>正文


Java ClsUtil类代码示例

本文整理汇总了Java中com.intellij.util.cls.ClsUtil的典型用法代码示例。如果您正苦于以下问题:Java ClsUtil类的具体用法?Java ClsUtil怎么用?Java ClsUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClsUtil类属于com.intellij.util.cls包,在下文中一共展示了ClsUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: markAnnotationDependenciesRecursively

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private void markAnnotationDependenciesRecursively(final Dependency[] dependencies, final @NonNls String reason, final TIntHashSet visitedAnnotations)
    throws CacheCorruptedException {
  final Cache oldCache = myDependencyCache.getCache();
  for (Dependency dependency : dependencies) {
    if (myDependencyCache.markTargetClassInfo(dependency)) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Mark dependent class " + myDependencyCache.resolve(dependency.getClassQualifiedName()) + reason);
      }
    }
    final int depQName = dependency.getClassQualifiedName();
    if (ClsUtil.isAnnotation(oldCache.getFlags(depQName))) {
      if (!visitedAnnotations.contains(depQName)) {
        visitedAnnotations.add(depQName);
        markAnnotationDependenciesRecursively(oldCache.getBackDependencies(depQName), LOG.isDebugEnabled()? "; reason: cascade semantics change for " + myDependencyCache.resolve(depQName) : "", visitedAnnotations);
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:JavaDependencyProcessor.java

示例2: hasBaseAbstractMethods

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private boolean hasBaseAbstractMethods(int qName, Set methodsToCheck) throws CacheCorruptedException {
  final SymbolTable symbolTable = myDependencyCache.getSymbolTable();
  final Cache oldCache = myDependencyCache.getCache();
  final Cache newCache = myDependencyCache.getNewClassesCache();
  final Cache cache = newCache.containsClass(qName)? newCache : oldCache; // use recompiled version (if any) for searching methods
  for (Iterator it = methodsToCheck.iterator(); it.hasNext();) {
    final MethodInfo methodInfo = (MethodInfo)it.next();
    final MethodInfo superMethod = cache.findMethodsBySignature(qName, methodInfo.getDescriptor(symbolTable), symbolTable);
    if (superMethod != null) {
      if (ClsUtil.isAbstract(superMethod.getFlags())) {
        return true;
      }
      it.remove();
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:JavaDependencyProcessor.java

示例3: findModifiedConstants

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private void findModifiedConstants(
  final int qName,
  Collection<ChangedConstantsDependencyProcessor.FieldChangeInfo> changedConstants,
  Collection<ChangedConstantsDependencyProcessor.FieldChangeInfo> removedConstants) throws CacheCorruptedException {

  final Cache cache = getCache();
  for (final FieldInfo field : cache.getFields(qName)) {
    final int oldFlags = field.getFlags();
    if (ClsUtil.isStatic(oldFlags) && ClsUtil.isFinal(oldFlags)) {
      final Cache newClassesCache = getNewClassesCache();
      FieldInfo newField = newClassesCache.findFieldByName(qName, field.getName());
      if (newField == null) {
        if (!ConstantValue.EMPTY_CONSTANT_VALUE.equals(field.getConstantValue())) {
          // if the field was really compile time constant
          removedConstants.add(new ChangedConstantsDependencyProcessor.FieldChangeInfo(field));
        }
      }
      else {
        final boolean visibilityRestricted = MakeUtil.isMoreAccessible(oldFlags, newField.getFlags());
        if (!field.getConstantValue().equals(newField.getConstantValue()) || visibilityRestricted) {
          changedConstants.add(new ChangedConstantsDependencyProcessor.FieldChangeInfo(field, visibilityRestricted));
        }
      }
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:DependencyCache.java

示例4: initConstantPool

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private void initConstantPool() throws ClsFormatException {
  if (myConstantPoolOffsets == null){
    BytePointer ptr = new BytePointer(getData(), 0);
    ConstantPoolIterator iterator = new ConstantPoolIterator(ptr);
    myConstantPoolOffsets = new int[iterator.getEntryCount()];
    myConstantPoolOffsets[0] = iterator.getCurrentOffset();
    int index = 1;
    while (iterator.hasMoreEntries()) {
      int tag = ClsUtil.readU1(ptr);
      if (tag == ClsUtil.CONSTANT_Long || tag == ClsUtil.CONSTANT_Double) {
        myConstantPoolOffsets[index++] = ptr.offset + 8; // takes 2 entries!
      }
      iterator.next();
      myConstantPoolOffsets[index++] = iterator.getCurrentOffset();
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:ClassFileReader.java

示例5: readConstant

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private ConstantValue readConstant(final BytePointer ptr) throws ClsFormatException {
  final int tag = ClsUtil.readU1(ptr);
  switch (tag) {
    case ClsUtil.CONSTANT_Integer :
      int value = ClsUtil.readU4(ptr);
      return new IntegerConstantValue(value);
    case ClsUtil.CONSTANT_Float:
      float floatValue = ClsUtil.readFloat(ptr);
      return new FloatConstantValue(floatValue);
    case ClsUtil.CONSTANT_Long :
      int high = ClsUtil.readU4(ptr);
      int low = ClsUtil.readU4(ptr);
      long v = ((long)high << 32) | (low & 0xFFFFFFFFL);
      return new LongConstantValue(v);
    case ClsUtil.CONSTANT_Double :
      double doubleValue = ClsUtil.readDouble(ptr);
      return new DoubleConstantValue(doubleValue);
    case ClsUtil.CONSTANT_String :
      int stringIndex = ClsUtil.readU2(ptr);
      ptr.offset = getOffsetInConstantPool(stringIndex);
      return new StringConstantValue(ClsUtil.readUtf8Info(ptr));
    default : throw new ClsFormatException();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:ClassFileReader.java

示例6: ConstantPoolIterator

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
public ConstantPoolIterator(BytePointer ptr) throws ClsFormatException {
  myPtr = ptr;
  myPtr.offset = 0;
  int magic = ClsUtil.readU4(myPtr);
  if (magic != ClsUtil.MAGIC){
    throw new ClsFormatException();
  }
  myPtr.offset += 2; // minor version
  myPtr.offset += 2; // major version
  myEntryCount = ClsUtil.readU2(myPtr);
  if (myEntryCount < 1){
    throw new ClsFormatException();
  }
  myCurrentEntryIndex = 1; // Entry at index 0 is included in the count but is not present in the constant pool
  myCurrentOffset = myPtr.offset;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ClassFileReader.java

示例7: markAnnotationDependenciesRecursively

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private void markAnnotationDependenciesRecursively(final Dependency[] dependencies, final @NonNls String reason, final TIntHashSet visitedAnnotations)
  throws CacheCorruptedException {
  final Cache oldCache = myJavaDependencyCache.getCache();
  for (Dependency dependency : dependencies) {
    if (myJavaDependencyCache.markTargetClassInfo(dependency)) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Mark dependent class " + myJavaDependencyCache.resolve(dependency.getClassQualifiedName()) + reason);
      }
    }
    final int depQName = dependency.getClassQualifiedName();
    if (ClsUtil.isAnnotation(oldCache.getFlags(depQName))) {
      if (!visitedAnnotations.contains(depQName)) {
        visitedAnnotations.add(depQName);
        markAnnotationDependenciesRecursively(oldCache.getBackDependencies(depQName), LOG.isDebugEnabled()? "; reason: cascade semantics change for " + myJavaDependencyCache.resolve(depQName) : "", visitedAnnotations);
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:JavaDependencyProcessor.java

示例8: hasBaseAbstractMethods

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private boolean hasBaseAbstractMethods(int qName, Set methodsToCheck) throws CacheCorruptedException {
  final SymbolTable symbolTable = myJavaDependencyCache.getSymbolTable();
  final Cache oldCache = myJavaDependencyCache.getCache();
  final Cache newCache = myJavaDependencyCache.getNewClassesCache();
  final Cache cache = newCache.containsClass(qName)? newCache : oldCache; // use recompiled version (if any) for searching methods
  for (Iterator it = methodsToCheck.iterator(); it.hasNext();) {
    final MethodInfo methodInfo = (MethodInfo)it.next();
    final MethodInfo superMethod = cache.findMethodsBySignature(qName, methodInfo.getDescriptor(symbolTable), symbolTable);
    if (superMethod != null) {
      if (ClsUtil.isAbstract(superMethod.getFlags())) {
        return true;
      }
      it.remove();
    }
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:JavaDependencyProcessor.java

示例9: findModifiedConstants

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private void findModifiedConstants(final int qName,
                                   Collection<ChangedConstantsDependencyProcessor.FieldChangeInfo> changedConstants,
                                   Collection<ChangedConstantsDependencyProcessor.FieldChangeInfo> removedConstants)
  throws CacheCorruptedException {

  final Cache cache = getCache();
  for (final FieldInfo field : cache.getFields(qName)) {
    final int oldFlags = field.getFlags();
    if (ClsUtil.isStatic(oldFlags) && ClsUtil.isFinal(oldFlags)) {
      final Cache newClassesCache = getNewClassesCache();
      FieldInfo newField = newClassesCache.findFieldByName(qName, field.getName());
      if (newField == null) {
        if (!ConstantValue.EMPTY_CONSTANT_VALUE.equals(field.getConstantValue())) {
          // if the field was really compile time constant
          removedConstants.add(new ChangedConstantsDependencyProcessor.FieldChangeInfo(field));
        }
      }
      else {
        final boolean visibilityRestricted = JavaMakeUtil.isMoreAccessible(oldFlags, newField.getFlags());
        if (!field.getConstantValue().equals(newField.getConstantValue()) || visibilityRestricted) {
          changedConstants.add(new ChangedConstantsDependencyProcessor.FieldChangeInfo(field, visibilityRestricted));
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:JavaDependencyCache.java

示例10: isMoreAccessible

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
/**
 * tests if the accessibility, denoted by flags1 is less restricted than the accessibility denoted by flags2
 *
 * @return true means flags1 is less restricted than flags2 <br>
 * false means flags1 define more restricted access than flags2 or they have equal accessibility
 */
public static boolean isMoreAccessible(int flags1, int flags2)
{
	if(ClsUtil.isPrivate(flags2))
	{
		return ClsUtil.isPackageLocal(flags1) || ClsUtil.isProtected(flags1) || ClsUtil.isPublic(flags1);
	}
	if(ClsUtil.isPackageLocal(flags2))
	{
		return ClsUtil.isProtected(flags1) || ClsUtil.isPublic(flags1);
	}
	if(ClsUtil.isProtected(flags2))
	{
		return ClsUtil.isPublic(flags1);
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:JavaMakeUtil.java

示例11: hasGenericsNameClashes

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
private static boolean hasGenericsNameClashes(final MethodInfo baseMethod, final Cache oldCache, final int subclassQName) throws CacheCorruptedException {
  // it is illegal if 2 methods in a hierarchy have 1) same name 2) different signatures 3) same erasure
  final List<MethodInfo> methods = oldCache.findMethodsByName(subclassQName, baseMethod.getName());
  if (methods.size() > 0) {
    for (final MethodInfo methodInSubclass : methods) {
      if (ClsUtil.isBridge(methodInSubclass.getFlags())) {
        continue;
      }
      if (baseMethod.getDescriptor() == methodInSubclass.getDescriptor() && baseMethod.getGenericSignature() != methodInSubclass.getGenericSignature()) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:JavaDependencyProcessor.java

示例12: isMoreAccessible

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
/**
 * tests if the accessibility, denoted by flags1 is less restricted than the accessibility denoted by flags2
 * @return true means flags1 is less restricted than flags2 <br>
 *         false means flags1 define more restricted access than flags2 or they have equal accessibility
 */
public static boolean isMoreAccessible(int flags1, int flags2) {
  if (ClsUtil.isPrivate(flags2)) {
    return ClsUtil.isPackageLocal(flags1) || ClsUtil.isProtected(flags1) || ClsUtil.isPublic(flags1);
  }
  if (ClsUtil.isPackageLocal(flags2)) {
    return ClsUtil.isProtected(flags1) || ClsUtil.isPublic(flags1);
  }
  if (ClsUtil.isProtected(flags2)) {
    return ClsUtil.isPublic(flags1);
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:MakeUtil.java

示例13: 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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:ClassFileReader.java

示例14: getSuperClass

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
/**
 * @return fully qualified name of the class' superclass. In case there is no super return ""
 */
public String getSuperClass() throws ClsFormatException {
  if (mySuperClassName == null) {
    BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd() + 4);
    int index = ClsUtil.readU2(ptr);
    if (index == 0) {
      if (CommonClassNames.JAVA_LANG_OBJECT.equals(getQualifiedName())) {
        mySuperClassName = "";
      }
      else {
        throw new ClsFormatException();
      }
    }
    else {
      ptr.offset = getOffsetInConstantPool(index);
      mySuperClassName = readClassInfo(ptr); // keep '$' in the name for anonymous classes
      if (isInterface()) {
        if (!CommonClassNames.JAVA_LANG_OBJECT.equals(mySuperClassName)) {
          throw new ClsFormatException();
        }
      }
      /*
      else {
        if (!MakeUtil.isAnonymous(mySuperClassName)) {
          mySuperClassName = mySuperClassName.replace('$', '.');
        }
      }
      */
    }
  }
  return mySuperClassName;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:ClassFileReader.java

示例15: getSuperInterfaces

import com.intellij.util.cls.ClsUtil; //导入依赖的package包/类
public String[] getSuperInterfaces() throws ClsFormatException {
  if (mySuperInterfaces == null) {
    BytePointer ptr = new BytePointer(getData(), getConstantPoolEnd() + 6);
    int count = ClsUtil.readU2(ptr);
    mySuperInterfaces = ArrayUtil.newStringArray(count);
    BytePointer auxPtr = new BytePointer(ptr.bytes, 0);
    for (int idx = 0; idx < mySuperInterfaces.length; idx++) {
      auxPtr.offset = getOffsetInConstantPool(ClsUtil.readU2(ptr));
      mySuperInterfaces[idx] = readClassInfo(auxPtr);
    }
  }
  return mySuperInterfaces;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:ClassFileReader.java


注:本文中的com.intellij.util.cls.ClsUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。