Bug 22093 - VerifyError due to duplicate access method
Summary: VerifyError due to duplicate access method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: Other other
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-07-31 16:23 EDT by Philipe Mulet CLA
Modified: 2002-09-20 09:34 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2002-07-31 16:23:20 EDT
Build R2.0

From EC:
-----------------
I ran into an apparent bug with the JDT compiler while working with some
open source code.  Everything works fine when built the the Sun 1.3.1_04
and 1.4.0 tools.  I stripped out the offending code and eliminated most
of the parts necessary to reproduce the error and wrote a small main
method for a simple test case.

The error I'm getting is...

java.lang.ClassFormatError: CrossRefList$CrossRef (Repetitive method
name/signature)
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
 at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
 at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
 at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
 at CrossRefList.main(CrossRefList.java:35)
Exception in thread "main" :

Passing a "-noverify" flag to the VM allows the test case to run but
does not work for the larger project.

Using Sun's javap tool on the Eclipse built code (built under both 1.3
and 1.4 compliance) gives:

$ javap CrossRefList
sun.tools.java.CompilerError: duplicate addition
        at sun.tools.java.MethodSet.add(MethodSet.java:85)
        at
sun.tools.java.ClassDefinition.collectInheritedMethods
(ClassDefinition.java:1472)

        at sun.tools.java.BinaryClass.basicCheck(BinaryClass.java:73)
        at
sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:130)

        at
sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:352)
        at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:221)
        at
sun.tools.javap.JavaPEnvironment.loadDefinition(JavaPEnvironment.java:221)

        at
sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:120)

        at
sun.tools.java.Environment.getClassDefinition(Environment.java:123)
        at sun.tools.javap.JavaP.displayResults(JavaP.java:193)
        at sun.tools.javap.JavaP.perform(JavaP.java:212)
        at sun.tools.javap.JavaP.entry(JavaP.java:233)
        at sun.tools.javap.JavaP.main(JavaP.java:220)
Exception in thread "main"

$ javap CrossRefList.CrossRef
sun.tools.java.CompilerError: duplicate addition
        at sun.tools.java.MethodSet.add(MethodSet.java:85)
        at
sun.tools.java.ClassDefinition.collectInheritedMethods
(ClassDefinition.java:1472)

        at sun.tools.java.BinaryClass.basicCheck(BinaryClass.java:73)
        at
sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:130)

        at
sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:352)
        at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:221)
        at
sun.tools.javap.JavaPEnvironment.loadDefinition(JavaPEnvironment.java:221)

        at
sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:120)

        at
sun.tools.java.Environment.getClassDefinition(Environment.java:123)
        at
sun.tools.java.Environment.getClassDefinition(Environment.java:84)
        at sun.tools.javap.JavaP.displayResults(JavaP.java:193)
        at sun.tools.javap.JavaP.perform(JavaP.java:212)
        at sun.tools.javap.JavaP.entry(JavaP.java:233)
        at sun.tools.javap.JavaP.main(JavaP.java:220)
Exception in thread "main"

The same code built under Sun's 1.3.1_04 and 1.4.0 compiler gives:
$ javap CrossRefList

Compiled from CrossRefList.java
public class CrossRefList extends java.lang.Object {
    public CrossRefList(java.lang.Object);
    public synchronized java.lang.Object first();
    public synchronized void link(CrossRefList);
    public static void main(java.lang.String[]);
    static java.lang.Object access$000(CrossRefList);
    protected class CrossRefList. CrossRef extends java.lang.Object
    /* ACC_SUPER bit NOT set */
{
        protected CrossRefList.CrossRef _far;
        static java.lang.Object access$100(CrossRefList.CrossRef);
        CrossRefList.CrossRef(CrossRefList,CrossRefList$1);

CrossRefList.CrossRef(CrossRefList,CrossRefList.CrossRef,CrossRefList$1);

    }
}

$ javap CrossRefList.CrossRef

Compiled from CrossRefList.java
protected class CrossRefList. CrossRef extends java.lang.Object
    /* ACC_SUPER bit NOT set */
{
    protected CrossRefList.CrossRef _far;
    static java.lang.Object access$100(CrossRefList.CrossRef);
    CrossRefList.CrossRef(CrossRefList,CrossRefList$1);

CrossRefList.CrossRef(CrossRefList,CrossRefList.CrossRef,CrossRefList$1);

}

I'm using the 2.0 release w/ build id 200206271827 and a cursory review
of the open bug list didn't show anything similar.

Here's the code with the main method test case.


public class CrossRefList {
    private int _size = 0;
    private CrossRef _headNode;
    private CrossRef _lastNode;
    private Object _container;

    protected class CrossRef {

        protected CrossRef _far;
        private CrossRef _next;
        private CrossRef _previous;

        private CrossRef() { this(null); }

        private CrossRef(CrossRef spouse) {
          super();
        }
        private synchronized Object _nearContainer() {
            return _container;
        }

        private synchronized Object _farContainer() {
            if (_far != null) return _far._nearContainer();
            else return null;
        }
    }

    public static void main(String[] args)
    {
     String container1 = new String("hello world");
     CrossRefList crl = new CrossRefList(container1);
     CrossRef localCrossRef = crl.new CrossRef();
    }
    public CrossRefList(Object container) {
        _container = container;
    }

    public synchronized Object first() {
        if (_headNode != null) {
            return _headNode._farContainer();
        } else {
            return null;
        }
    }
    public synchronized void link(CrossRefList farList)
    {
        CrossRef localCrossRef = new CrossRef();
        if (farList != null) {
           localCrossRef._far = farList.new CrossRef(localCrossRef);
        }
    }
}


--mike
mike.jones@cognitech-ut.com
Comment 1 Philipe Mulet CLA 2002-07-31 16:51:42 EDT
Bug found. The problem was in the collision check with existing methods/access 
methods when about to add a new synthetic method. The check against access 
methods was wrong (copy/paste mistake) and did not perform as it should have.

Fixed in latest. Will release the fix for 2.0.1 as well.
Comment 2 Jerome Lanneluc CLA 2002-08-19 09:42:30 EDT
Verified
Comment 3 David Audel CLA 2002-08-20 03:49:55 EDT
Verified.
Comment 4 David Audel CLA 2002-09-20 09:34:04 EDT
Verified in 2.1 M1