Examples of XClass


Examples of edu.umd.cs.findbugs.ba.XClass

    public static final Pattern mapSignaturePattern = Pattern.compile("<(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*):L[^;]*;(\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*):L[^;]*;>.*Ljava/util/(\\p{javaJavaIdentifierStart}(\\p{javaJavaIdentifierPart}|/)*)?Map<T\\1;T\\2;>;.*");
    public static boolean isStraightGenericMap(ClassDescriptor c) {
        if (c.matches(Map.class)) {
            return true;
        }
        XClass xc;
        try {
            xc = c.getXClass();
        } catch (CheckedAnalysisException e) {
            return false;
        }
        String sourceSignature = xc.getSourceSignature();
        if (sourceSignature == null) {
            return false;
        }
        if (sourceSignature.startsWith("<")) {
            Matcher matcher = mapSignaturePattern.matcher(sourceSignature);
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XClass

        if (seen == PUTFIELD) {
            OpcodeStack.Item obj = stack.getStackItem(1);
            OpcodeStack.Item value = stack.getStackItem(0);
            XField f = getXFieldOperand();
            XClass x = getXClassOperand();

            checkPUTFIELD: if (putFieldPC + 10 > getPC() && f != null && obj != null && f.equals(putFieldXField)
                    && !f.isSynthetic() && obj.equals(putFieldObj) && x != null) {

                LineNumberTable table = getCode().getLineNumberTable();
                if (table != null) {
                    int first = table.getSourceLine(putFieldPC);
                    int second = table.getSourceLine(getPC());
                    if (first + 1 != second && first != second) {
                        break checkPUTFIELD;
                    }
                } else if (putFieldPC + 3 != getPC()) {
                    break checkPUTFIELD;
                }

                int priority = NORMAL_PRIORITY;
                if (value.equals(putFieldValue) && putFieldPC + 3 != getPC()) {
                    priority++;
                }
                boolean storeOfDefaultValue = putFieldValue.isNull() || putFieldValue.hasConstantValue(0);
                if (storeOfDefaultValue) {
                    priority++;
                }
                if (f.isVolatile()) {
                    priority++;
                }
                XField intendedTarget = null;

                double minimumDistance = 2;
                int matches = 0;
                for (XField f2 : x.getXFields()) {
                    if (!f.equals(f2) && !f2.isStatic() && !f2.isFinal() && !f2.isSynthetic()
                            && f2.getSignature().equals(f.getSignature())) {

                        double distance = EditDistance.editDistanceRatio(f.getName(), f2.getName());
                        matches++;
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XClass

        }
        case INVOKEVIRTUAL:
        case INVOKEINTERFACE: {
            if (getDottedClassConstantOperand().equals("java.util.concurrent.ConcurrentHashMap")) {
                String methodName = getNameConstantOperand();
                XClass xClass = getXClassOperand();
                if (xClass != null && methodName.equals("put")) {
                    if ((getPC() < lastQuestionableCheckTarget) && (lastQuestionableCheckTarget != -1)) {
                        bugReporter.reportBug(new BugInstance(this, "AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION", priority)
                        .addClassAndMethod(this).addType(xClass.getClassDescriptor()).addCalledMethod(this)
                        .addSourceLine(this));
                    }
                }
            }
            break;
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XClass

    public static SourceLineAnnotation forFirstLineOfMethod(MethodDescriptor methodDescriptor) {
        SourceLineAnnotation result = null;

        try {
            Method m = Global.getAnalysisCache().getMethodAnalysis(Method.class, methodDescriptor);
            XClass xclass = Global.getAnalysisCache().getClassAnalysis(XClass.class, methodDescriptor.getClassDescriptor());
            LineNumberTable lnt = m.getLineNumberTable();
            String sourceFile = xclass.getSource();
            if (sourceFile != null && lnt != null) {
                int firstLine = Integer.MAX_VALUE;
                int bytecode = 0;
                LineNumber[] entries = lnt.getLineNumberTable();
                for (LineNumber entry : entries) {
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XClass

        this.bugReporter = bugReporter;
    }

    @Override
    public boolean shouldVisit(JavaClass obj) {
        XClass xClass = getXClass();
        return xClass.getCalledClassDescriptors().contains(ObjectOutputStream)
                || xClass.getCalledClassDescriptors().contains(ObjectInputStream);
    }
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XClass

            if (c == null || !Subtypes2.instanceOf(c, Serializable.class)) {
                return;
            }

            try {
                XClass xClass = Global.getAnalysisCache().getClassAnalysis(XClass.class, c);
                if (xClass.isInterface()) {
                    return;
                }
                if (xClass.isSynthetic()) {
                    return;
                }
                if (xClass.isAbstract()) {
                    return;
                }
                unreadFields.strongEvidenceForIntendedSerialization(c);
            } catch (CheckedAnalysisException e) {
                bugReporter.logError("Error looking up xClass of " + c, e);
            }

        }
        if (seen == CHECKCAST) {
            OpcodeStack.Item top = stack.getStackItem(0);
            if (readObject.equals(top.getReturnValueOf())) {
                ClassDescriptor c = getClassDescriptorOperand();
                if (!Subtypes2.instanceOf(c, Serializable.class)) {
                    return;
                }

                try {
                    XClass xClass = Global.getAnalysisCache().getClassAnalysis(XClass.class, c);
                    if (xClass.isInterface()) {
                        return;
                    }
                    if (xClass.isSynthetic()) {
                        return;
                    }
                    if (xClass.isAbstract()) {
                        return;
                    }
                    unreadFields.strongEvidenceForIntendedSerialization(c);
                } catch (CheckedAnalysisException e) {
                    bugReporter.logError("Error looking up xClass of " + c, e);
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    ReflectionManager reflectionManager = SearchFactoryImpl.getReflectionManager(cfg);
    //get the most specialized (ie subclass > superclass) non default index name
    //if none extract the name from the most generic (superclass > subclass) @Indexed class in the hierarchy
    //FIXME I'm inclined to get rid of the default value
    PersistentClass pc = cfg.getClassMapping( clazz.getName() );
    XClass rootIndex = null;
    do {
      XClass currentClazz = reflectionManager.toXClass( pc.getMappedClass() );
      Indexed indexAnn = currentClazz.getAnnotation( Indexed.class );
      if ( indexAnn != null ) {
        if ( indexAnn.index().length() != 0 ) {
          return indexAnn.index();
        }
        else {
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    // order the hierarchy
    List<XClass> workingCopy = new ArrayList<XClass>( copy );
    List<XClass> newList = new ArrayList<XClass>( copy.size() );
    while ( workingCopy.size() > 0 ) {
      XClass clazz = workingCopy.get( 0 );
      orderHierarchy( workingCopy, newList, copy, clazz );
    }
    return newList;
  }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

    return newList;
  }

  private void insertMappedSuperclasses(List<XClass> original, List<XClass> copy) {
    for ( XClass clazz : original ) {
      XClass superClass = clazz.getSuperclass();
      while ( superClass != null && !reflectionManager.equals( superClass, Object.class ) && !copy.contains(
          superClass
      ) ) {
        if ( superClass.isAnnotationPresent( Entity.class )
            || superClass.isAnnotationPresent( MappedSuperclass.class ) ) {
          copy.add( superClass );
        }
        superClass = superClass.getSuperclass();
      }
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.reflection.XClass

   * @param persistentClass the mapped class
   *
   * @return the configuration object
   */
  public AnnotationConfiguration addAnnotatedClass(Class persistentClass) throws MappingException {
    XClass persistentXClass = reflectionManager.toXClass( persistentClass );
    try {
      annotatedClasses.add( persistentXClass );
      return this;
    }
    catch ( MappingException me ) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.