Bug 265104 - Reconciler cannot handle annotation with reference to missing type
Summary: Reconciler cannot handle annotation with reference to missing type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL: http://lhunath.lyndir.com/stuff/remot...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-17 04:09 EST by Maarten Billemont CLA
Modified: 2009-04-28 09:21 EDT (History)
3 users (show)

See Also:


Attachments
Eclipse Project that exhibits the problem. (1.13 KB, application/x-bzip2)
2009-02-18 03:44 EST, Maarten Billemont CLA
no flags Details
Proposed patch (6.51 KB, patch)
2009-03-12 14:03 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maarten Billemont CLA 2009-02-17 04:09:47 EST
Build ID: M20080911-1700

Steps To Reproduce:
As far as I know, make a bean class with:
1. The @Stateless annotation
2. The @LocalBinding annotation
3. The @RemoteBinding annotation

More information:
http://lhunath.lyndir.com/stuff/remotebinding.png
Comment 1 Philipe Mulet CLA 2009-02-17 04:37:38 EST
Please provide more information.

Which version of Eclipse are you using ? 4.0 is not out yet
Also provide detailed steps to recreate, with a small test program reproducing.
Comment 2 Maarten Billemont CLA 2009-02-18 03:44:47 EST
Created attachment 125998 [details]
Eclipse Project that exhibits the problem.
Comment 3 Maarten Billemont CLA 2009-02-18 03:46:13 EST
I don't know why it put the version on 4.0 - The build ID is in the primary description; this is version 3.4.1 
Comment 4 Maarten Billemont CLA 2009-02-18 03:49:19 EST
The project requires two dependencies:
    <classpathentry kind="lib" path="/Users/lhunath/.m2/repository/javaee/javaee-api/5/javaee-api-5.jar"/>
    <classpathentry kind="lib" path="/Users/lhunath/.m2/repository/org/jboss/jboss-annotations-ejb3/4.2.2.GA/jboss-annotations-ejb3-4.2.2.GA.jar"/>

Those are for the annotations used in the project.  javaee-api-5.jar provides @Stateless and jboss-annotations-ejb3-4.2.2.GA.jar provides @RemoteBinding.

To obtain them; see
http://download.java.net/maven/1/javaee/jars/
http://repository.jboss.org/maven2/jboss/jboss-annotations-ejb3/4.2.2.GA/

I'm sure plenty of mirrors can be found on google if those give problems (I just found those by googling a bit)
Comment 5 Kent Johnson CLA 2009-03-11 15:57:35 EDT
Somehow the reconciler is dealing with an annotation:

import org.jboss.annotation.ejb.RemoteBinding;
@RemoteBinding(jndiBinding = RemoteFoo.JNDI_BINDING)
public class Foo implements RemoteFoo {}

differently than the normal compile/build loop.

RemoteBinding.class has a reference to a missing type org.jboss.ejb3.remoting.RemoteProxyFactory that only shows up in the editor and not after a build.
Comment 6 Kent Johnson CLA 2009-03-11 16:42:04 EDT
The referenced annotation type org.jboss.ejb3.remoting.RemoteProxyFactory has a method factory() with a default value of the missing type :

AnnotationMethodInfo{public factory()Ljava/lang/Class;} default Lorg/jboss/ejb3/remoting/RemoteProxyFactory;.class

The normal compilation loop does not need/resolve annotations but the editor/reconciler do, where we are resolving the defaultValue as soon as create the method factory().
Comment 7 Kent Johnson CLA 2009-03-12 14:01:52 EDT
The testcase is:

import org.jboss.annotation.ejb.RemoteBinding;
import javax.ejb.Remote;

@RemoteBinding(jndiBinding = RemoteFoo.JNDI_BINDING)
class Foo implements RemoteFoo {}

@Remote interface RemoteFoo {
	public static final String JNDI_BINDING = "";
}

with the 2 jars from comment #4
Comment 8 Kent Johnson CLA 2009-03-12 14:03:40 EDT
Created attachment 128599 [details]
Proposed patch

This patch delays resolving the defaultValue of an annotation in a binary method until its requested
Comment 9 Kent Johnson CLA 2009-03-19 13:40:04 EDT
Fix released for 3.5M7

To verify, add this to an editor in a project with the 2 jars from comment #4:

import org.jboss.annotation.ejb.RemoteBinding;
import javax.ejb.Remote;

@RemoteBinding(jndiBinding = RemoteFoo.JNDI_BINDING)
class Foo implements RemoteFoo {}

@Remote interface RemoteFoo {
        public static final String JNDI_BINDING = "";
}


Without the patch, a missing type error should appear in the editor but no error should appear with the patch.
Comment 10 Jay Arthanareeswaran CLA 2009-04-28 05:33:58 EDT
Verified for 3.5M7 using build I20090426-2000