< prev index next >

src/java.xml/share/classes/com/sun/org/apache/bcel/internal/classfile/JavaClass.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

@@ -37,20 +37,19 @@
 import com.sun.org.apache.bcel.internal.util.BCELComparator;
 import com.sun.org.apache.bcel.internal.util.ClassQueue;
 import com.sun.org.apache.bcel.internal.util.SyntheticRepository;
 
 /**
- * Represents a Java class, i.e., the data structures, constant pool, fields,
- * methods and commands contained in a Java .class file. See <a
- * href="http://docs.oracle.com/javase/specs/">JVM specification</a> for
- * details. The intent of this class is to represent a parsed or otherwise
- * existing class file. Those interested in programatically generating classes
+ * Represents a Java class, i.e., the data structures, constant pool,
+ * fields, methods and commands contained in a Java .class file.
+ * See <a href="http://docs.oracle.com/javase/specs/">JVM specification</a> for details.
+ * The intent of this class is to represent a parsed or otherwise existing
+ * class file.  Those interested in programatically generating classes
  * should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
 
- * @version $Id$
  * @see com.sun.org.apache.bcel.internal.generic.ClassGen
- * @LastModified: Jun 2019
+ * @LastModified: Jan 2020
  */
 public class JavaClass extends AccessFlags implements Cloneable, Node, Comparable<JavaClass> {
 
     private String file_name;
     private String package_name;

@@ -73,10 +72,11 @@
     private boolean isNested = false;
     private boolean computedNestedTypeStatus = false;
     public static final byte HEAP = 1;
     public static final byte FILE = 2;
     public static final byte ZIP = 3;
+    private static final boolean debug = false;
 
     private static BCELComparator bcelComparator = new BCELComparator() {
 
         @Override
         public boolean equals( final Object o1, final Object o2 ) {

@@ -216,10 +216,20 @@
     @Override
     public void accept( final Visitor v ) {
         v.visitJavaClass(this);
     }
 
+
+    /* Print debug information depending on `JavaClass.debug'
+     */
+    static void Debug( final String str ) {
+        if (debug) {
+            System.out.println(str);
+        }
+    }
+
+
     /**
      * Dump class to a file.
      *
      * @param file Output file
      * @throws IOException

@@ -604,11 +614,11 @@
                     buf.append(", ");
                 }
             }
             buf.append('\n');
         }
-        buf.append("filename\t\t").append(file_name).append('\n');
+        buf.append("file name\t\t").append(file_name).append('\n');
         buf.append("compiled from\t\t").append(source_file_name).append('\n');
         buf.append("compiler version\t").append(major).append(".").append(minor).append('\n');
         buf.append("access flags\t\t").append(super.getAccessFlags()).append('\n');
         buf.append("constant pool\t\t").append(constant_pool.getLength()).append(" entries\n");
         buf.append("ACC_SUPER flag\t\t").append(isSuper()).append("\n");

@@ -714,11 +724,11 @@
                   final InnerClass[] innerClasses = ((InnerClasses) attribute).getInnerClasses();
                   for (final InnerClass innerClasse : innerClasses) {
                       boolean innerClassAttributeRefersToMe = false;
                       String inner_class_name = constant_pool.getConstantString(innerClasse.getInnerClassIndex(),
                                  Const.CONSTANT_Class);
-                      inner_class_name = Utility.compactClassName(inner_class_name);
+                      inner_class_name = Utility.compactClassName(inner_class_name, false);
                       if (inner_class_name.equals(getClassName())) {
                           innerClassAttributeRefersToMe = true;
                       }
                       if (innerClassAttributeRefersToMe) {
                           this.isNested = true;

@@ -752,11 +762,11 @@
 
     /**
      * Sets the ClassRepository which loaded the JavaClass.
      * Should be called immediately after parsing is done.
      */
-    public void setRepository(final com.sun.org.apache.bcel.internal.util.Repository repository) {
+    public void setRepository( final com.sun.org.apache.bcel.internal.util.Repository repository ) { // TODO make protected?
         this.repository = repository;
     }
 
 
     /** Equivalent to runtime "instanceof" operator.
< prev index next >