test_class.file: lang-java/src/test/java/org/eclipse/steady/java/monitor/ClassVisitorTest.java
test_class.identifier: ClassVisitorTest
test_class.superclass: extends AbstractGoalTest
test_case.body: @Test
    public void testNonStaticInnerClassConstructor() {
      try {
        // The test class
        final JavaClassId cid =
            JavaId.parseClassQName("org.eclipse.steady.java.monitor.ClassVisitorTest$NonStaticInner");
  
        // Get a CtClass and identify its constructors
        final ClassPool cp = ClassPool.getDefault();
        final CtClass ctclass = cp.get(cid.getQualifiedName());
        final ClassVisitor cv = new ClassVisitor(ctclass);
        final Set<ConstructId> constructors = cv.visitConstructors(false);
  
        // Expected result (no first parameter of type outer class, no diamond for type parameters)
        final JavaConstructorId expected =
            JavaId.parseConstructorQName(
                "org.eclipse.steady.java.monitor.ClassVisitorTest$NonStaticInner(Map)");
  
        // Check that certain constructs have been found
        assertEquals(expected, constructors.iterator().next());
      } catch (NotFoundException e) {
        System.err.println(e.getMessage());
        assertTrue(false);
      } catch (CannotCompileException e) {
        System.err.println(e.getMessage());
        assertTrue(false);
      }
    }
test_case.class_method_signature: ClassVisitorTest.testNonStaticInnerClassConstructor()
test_case.full_signature: @Test public void testNonStaticInnerClassConstructor()
test_case.identifier: testNonStaticInnerClassConstructor
test_case.invocations: parseClassQName getDefault get getQualifiedName visitConstructors parseConstructorQName assertEquals next iterator println getMessage assertTrue println getMessage assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNonStaticInnerClassConstructor()
focal_class.declarator: log = null
focal_class.modifier: private static
focal_class.original_string: private static Logger log = null;
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: javaId = null
focal_class.modifier: private
focal_class.original_string: private JavaId javaId = null;
focal_class.type: JavaId
focal_class.var_name: javaId
focal_class.declarator: qname = null
focal_class.modifier: private
focal_class.original_string: private String qname = null;
focal_class.type: String
focal_class.var_name: qname
focal_class.declarator: c = null
focal_class.modifier: private
focal_class.original_string: private CtClass c = null;
focal_class.type: CtClass
focal_class.var_name: c
focal_class.declarator: declaringClass = null
focal_class.modifier: private
focal_class.original_string: private CtClass declaringClass = null;
focal_class.type: CtClass
focal_class.var_name: declaringClass
focal_class.declarator: isInstrumented = null
focal_class.modifier: private
focal_class.original_string: private Boolean isInstrumented = null;
focal_class.type: Boolean
focal_class.var_name: isInstrumented
focal_class.declarator: originalArchiveDigest = null
focal_class.modifier: private
focal_class.original_string: private String originalArchiveDigest = null;
focal_class.type: String
focal_class.var_name: originalArchiveDigest
focal_class.declarator: appContext = null
focal_class.modifier: private
focal_class.original_string: private Application appContext = null;
focal_class.type: Application
focal_class.var_name: appContext
focal_class.declarator: bytes = null
focal_class.modifier: private
focal_class.original_string: private byte[] bytes = null;
focal_class.type: byte[]
focal_class.var_name: bytes
focal_class.declarator: major = 0
focal_class.modifier: private
focal_class.original_string: private int major = 0;
focal_class.type: int
focal_class.var_name: major
focal_class.declarator: minor = 0
focal_class.modifier: private
focal_class.original_string: private int minor = 0;
focal_class.type: int
focal_class.var_name: minor
focal_class.declarator: constructs = null
focal_class.modifier: private
focal_class.original_string: private Set<ConstructId> constructs = null;
focal_class.type: Set<ConstructId>
focal_class.var_name: constructs
focal_class.declarator: writeCodeToTmp = false
focal_class.modifier: private
focal_class.original_string: private boolean writeCodeToTmp = false;
focal_class.type: boolean
focal_class.var_name: writeCodeToTmp
focal_class.declarator: fieldAnnotations = null
focal_class.modifier: private
focal_class.original_string: private String[] fieldAnnotations = null;
focal_class.type: String[]
focal_class.var_name: fieldAnnotations
focal_class.declarator: QUALIFIED_TYPE_PATTERN = null
focal_class.modifier: private static
focal_class.original_string: private static Pattern QUALIFIED_TYPE_PATTERN = null;
focal_class.type: Pattern
focal_class.var_name: QUALIFIED_TYPE_PATTERN
focal_class.declarator: NESTED_CLASS_PATTERN = null
focal_class.modifier: private static
focal_class.original_string: private static Pattern NESTED_CLASS_PATTERN = null;
focal_class.type: Pattern
focal_class.var_name: NESTED_CLASS_PATTERN
focal_class.file: lang-java/src/main/java/org/eclipse/steady/java/monitor/ClassVisitor.java
focal_class.identifier: ClassVisitor
focal_class.class_method_signature: ClassVisitor.getLog()
focal_class.full_signature: private static final Logger getLog()
focal_class.identifier: getLog
focal_class.modifiers: private static final
focal_class.parameters: ()
focal_class.return: Logger
focal_class.signature: Logger getLog()
focal_class.class_method_signature: ClassVisitor.ClassVisitor(CtClass _c)
focal_class.full_signature: public  ClassVisitor(CtClass _c)
focal_class.identifier: ClassVisitor
focal_class.modifiers: public
focal_class.parameters: (CtClass _c)
focal_class.signature:  ClassVisitor(CtClass _c)
focal_class.class_method_signature: ClassVisitor.getConstructs()
focal_class.full_signature: public Set<ConstructId> getConstructs()
focal_class.identifier: getConstructs
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Set<ConstructId>
focal_class.signature: Set<ConstructId> getConstructs()
focal_class.class_method_signature: ClassVisitor.isInstrumented()
focal_class.full_signature: public synchronized boolean isInstrumented()
focal_class.identifier: isInstrumented
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isInstrumented()
focal_class.class_method_signature: ClassVisitor.visitMethods(boolean _instrument)
focal_class.full_signature: public synchronized Set<ConstructId> visitMethods(boolean _instrument)
focal_class.identifier: visitMethods
focal_class.modifiers: public synchronized
focal_class.parameters: (boolean _instrument)
focal_class.return: Set<ConstructId>
focal_class.signature: Set<ConstructId> visitMethods(boolean _instrument)
focal_class.class_method_signature: ClassVisitor.visitConstructors(boolean _instrument)
focal_class.full_signature: public synchronized Set<ConstructId> visitConstructors(boolean _instrument)
focal_class.identifier: visitConstructors
focal_class.modifiers: public synchronized
focal_class.parameters: (boolean _instrument)
focal_class.return: Set<ConstructId>
focal_class.signature: Set<ConstructId> visitConstructors(boolean _instrument)
focal_class.class_method_signature: ClassVisitor.instrument(JavaId _jid, CtBehavior _behavior)
focal_class.full_signature: private void instrument(JavaId _jid, CtBehavior _behavior)
focal_class.identifier: instrument
focal_class.modifiers: private
focal_class.parameters: (JavaId _jid, CtBehavior _behavior)
focal_class.return: void
focal_class.signature: void instrument(JavaId _jid, CtBehavior _behavior)
focal_class.class_method_signature: ClassVisitor.setOriginalArchiveDigest(String _sha1)
focal_class.full_signature: public synchronized void setOriginalArchiveDigest(String _sha1)
focal_class.identifier: setOriginalArchiveDigest
focal_class.modifiers: public synchronized
focal_class.parameters: (String _sha1)
focal_class.return: void
focal_class.signature: void setOriginalArchiveDigest(String _sha1)
focal_class.class_method_signature: ClassVisitor.setAppContext(Application _ctx)
focal_class.full_signature: public synchronized void setAppContext(Application _ctx)
focal_class.identifier: setAppContext
focal_class.modifiers: public synchronized
focal_class.parameters: (Application _ctx)
focal_class.return: void
focal_class.signature: void setAppContext(Application _ctx)
focal_class.class_method_signature: ClassVisitor.finalizeInstrumentation()
focal_class.full_signature: public synchronized void finalizeInstrumentation()
focal_class.identifier: finalizeInstrumentation
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void finalizeInstrumentation()
focal_class.class_method_signature: ClassVisitor.getBytecode()
focal_class.full_signature: public byte[] getBytecode()
focal_class.identifier: getBytecode
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: byte[]
focal_class.signature: byte[] getBytecode()
focal_class.class_method_signature: ClassVisitor.addBooleanMember(String _field_name, boolean _value, boolean _final)
focal_class.full_signature: public synchronized void addBooleanMember(String _field_name, boolean _value, boolean _final)
focal_class.identifier: addBooleanMember
focal_class.modifiers: public synchronized
focal_class.parameters: (String _field_name, boolean _value, boolean _final)
focal_class.return: void
focal_class.signature: void addBooleanMember(String _field_name, boolean _value, boolean _final)
focal_class.class_method_signature: ClassVisitor.addFieldAnnotations(CtField _fld, String[] _annotations)
focal_class.full_signature: private void addFieldAnnotations(CtField _fld, String[] _annotations)
focal_class.identifier: addFieldAnnotations
focal_class.modifiers: private
focal_class.parameters: (CtField _fld, String[] _annotations)
focal_class.return: void
focal_class.signature: void addFieldAnnotations(CtField _fld, String[] _annotations)
focal_class.class_method_signature: ClassVisitor.addIntMember(String _field_name, boolean _final)
focal_class.full_signature: public synchronized void addIntMember(String _field_name, boolean _final)
focal_class.identifier: addIntMember
focal_class.modifiers: public synchronized
focal_class.parameters: (String _field_name, boolean _final)
focal_class.return: void
focal_class.signature: void addIntMember(String _field_name, boolean _final)
focal_class.class_method_signature: ClassVisitor.getUniqueMemberName(String _prefix, String _construct_name, boolean _random_part)
focal_class.full_signature: public String getUniqueMemberName(String _prefix, String _construct_name, boolean _random_part)
focal_class.identifier: getUniqueMemberName
focal_class.modifiers: public
focal_class.parameters: (String _prefix, String _construct_name, boolean _random_part)
focal_class.return: String
focal_class.signature: String getUniqueMemberName(String _prefix, String _construct_name, boolean _random_part)
focal_class.class_method_signature: ClassVisitor.getClassPattern()
focal_class.full_signature: private static synchronized Pattern getClassPattern()
focal_class.identifier: getClassPattern
focal_class.modifiers: private static synchronized
focal_class.parameters: ()
focal_class.return: Pattern
focal_class.signature: Pattern getClassPattern()
focal_class.class_method_signature: ClassVisitor.getNestedClassPattern()
focal_class.full_signature: private static synchronized Pattern getNestedClassPattern()
focal_class.identifier: getNestedClassPattern
focal_class.modifiers: private static synchronized
focal_class.parameters: ()
focal_class.return: Pattern
focal_class.signature: Pattern getNestedClassPattern()
focal_class.class_method_signature: ClassVisitor.removeParameterQualification(String _string)
focal_class.full_signature: public static String removeParameterQualification(String _string)
focal_class.identifier: removeParameterQualification
focal_class.modifiers: public static
focal_class.parameters: (String _string)
focal_class.return: String
focal_class.signature: String removeParameterQualification(String _string)
focal_class.class_method_signature: ClassVisitor.removePackageContext(String _string)
focal_class.full_signature: public static String removePackageContext(String _string)
focal_class.identifier: removePackageContext
focal_class.modifiers: public static
focal_class.parameters: (String _string)
focal_class.return: String
focal_class.signature: String removePackageContext(String _string)
focal_class.class_method_signature: ClassVisitor.getJavaId()
focal_class.full_signature: public JavaId getJavaId()
focal_class.identifier: getJavaId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: JavaId
focal_class.signature: JavaId getJavaId()
focal_class.class_method_signature: ClassVisitor.getCtClass()
focal_class.full_signature: public CtClass getCtClass()
focal_class.identifier: getCtClass
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: CtClass
focal_class.signature: CtClass getCtClass()
focal_class.class_method_signature: ClassVisitor.getArchiveDigest()
focal_class.full_signature: public String getArchiveDigest()
focal_class.identifier: getArchiveDigest
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getArchiveDigest()
focal_class.class_method_signature: ClassVisitor.getAppContext()
focal_class.full_signature: public synchronized Application getAppContext()
focal_class.identifier: getAppContext
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: Application
focal_class.signature: Application getAppContext()
focal_class.class_method_signature: ClassVisitor.getQname()
focal_class.full_signature: public String getQname()
focal_class.identifier: getQname
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getQname()
focal_class.class_method_signature: ClassVisitor.getOriginalArchiveDigest()
focal_class.full_signature: public synchronized String getOriginalArchiveDigest()
focal_class.identifier: getOriginalArchiveDigest
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getOriginalArchiveDigest()
focal_class.class_method_signature: ClassVisitor.prettyPrint(String _src)
focal_class.full_signature: public static final String prettyPrint(String _src)
focal_class.identifier: prettyPrint
focal_class.modifiers: public static final
focal_class.parameters: (String _src)
focal_class.return: String
focal_class.signature: String prettyPrint(String _src)
focal_class.class_method_signature: ClassVisitor.getIndent(String _c, int _i)
focal_class.full_signature: private static String getIndent(String _c, int _i)
focal_class.identifier: getIndent
focal_class.modifiers: private static
focal_class.parameters: (String _c, int _i)
focal_class.return: String
focal_class.signature: String getIndent(String _c, int _i)
focal_method.body: public synchronized Set<ConstructId> visitConstructors(boolean _instrument)
        throws CannotCompileException {
      final Set<ConstructId> constructs = new HashSet<ConstructId>();
      final CtConstructor[] constructors = this.c.getDeclaredConstructors();
      String constr_name = null;
      JavaId jid = null;
  
      // Skip the first constructor parameter (added by the compiler for non-static classes)?
      final String param_to_skip =
          (this.declaringClass != null && !Modifier.isStatic(this.c.getModifiers())
              ? ClassVisitor.removePackageContext(this.declaringClass.getName())
              : null);
  
      // Static initializer <clinit> exists: Add it to the constructs and instrument (if requested)
      final CtConstructor initializer = this.c.getClassInitializer();
      if (initializer != null && this.javaId.getType() == Type.CLASS) {
        jid = ((JavaClassId) this.javaId).getClassInit();
        constructs.add(jid);
  
        // Instrument if requested
        if (_instrument
            && !isInstrumented()
            && !initializer.isEmpty()
            && initializer.getLongName().startsWith(this.qname)) {
          try {
            constr_name = this.removeParameterQualification(initializer.getLongName());
            this.instrument(jid, initializer);
          }
          // Can happen if dependencies of the class are not available in the ClassPool
          catch (CannotCompileException ex) {
            // ClassVisitor.getLog().error("Exception while instrumenting initializer [" + constr_name
            // + "]: " + ex.getMessage());
            throw ex;
          }
        }
      }
  
      // Loop all constructors and instrument (if requested)
      for (CtConstructor constr : constructors) {
        jid =
            JavaId.parseConstructorQName(
                this.javaId.getType(),
                ClassVisitor.removeParameterQualification(constr.getLongName()),
                param_to_skip);
        constructs.add(jid);
  
        // Instrument if requested
        if (_instrument
            && !isInstrumented()
            && !constr.isEmpty()
            && constr.getLongName().startsWith(this.qname)) {
          try {
            constr_name = this.removeParameterQualification(constr.getLongName());
            this.instrument(jid, constr);
          }
          // Can happen if dependencies of the class are not available in the ClassPool
          catch (CannotCompileException ex) {
            // ClassVisitor.getLog().error("Exception while instrumenting constructor [" + constr_name
            // + "]: " + ex.getMessage());
            throw ex;
          }
        }
      }
      ClassVisitor.getLog()
          .debug("Class '" + this.qname + "': " + constructors.length + " constructors");
      return constructs;
    }
focal_method.class_method_signature: ClassVisitor.visitConstructors(boolean _instrument)
focal_method.full_signature: public synchronized Set<ConstructId> visitConstructors(boolean _instrument)
focal_method.identifier: visitConstructors
focal_method.invocations: getDeclaredConstructors isStatic getModifiers removePackageContext getName getClassInitializer getType getClassInit add isInstrumented isEmpty startsWith getLongName removeParameterQualification getLongName instrument parseConstructorQName getType removeParameterQualification getLongName add isInstrumented isEmpty startsWith getLongName removeParameterQualification getLongName instrument debug getLog
focal_method.modifiers: public synchronized
focal_method.parameters: (boolean _instrument)
focal_method.return: Set<ConstructId>
focal_method.signature: Set<ConstructId> visitConstructors(boolean _instrument)