Community
Participate
Working Groups
The aspect below fails to compile with 1.1b2, producing the compilation error: -------------------- $ ajc com/ibm/amc/*.java com/ibm/amc/ejb/*.java d:/eclipse/runtime-workspace-ajsamples/Mock EJBs/com/ibm/amc/DemoBeanEJB.java:1: Cannot assign a value to the final field com.ibm.amc.DemoBean.ajc$interField$co m_ibm_amc$verbose !! no source information available !! 1 error --------------------------- package com.ibm.amc; import com.ibm.amc.ejb.SessionBean; /** * @author colyer * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public aspect DemoBeanEJB { declare parents: DemoBean implements SessionBean; // THIS NEXT LINE IS THE CULPRIT static final boolean DemoBean.verbose = true; private transient String DemoBean.ctx; public void DemoBean.ejbActivate( ) { if ( verbose ) { System.out.println( "ejbActivate Called" ); } } } ------------------- Making the inter-type declaration non-final solves the problem...
Created attachment 2885 [details] Mini-project that reproduces the error
This seems like it could be reduced to a much smaller minimal test case that would be easier to add to our test suite. Can you reproduce this with just 2 classes an no external dependencies?
Created attachment 2918 [details] Smallest possible test that reproduces the problem :-). Yes, here's a 5-line program that reproduces the problem. Thanks, Adrian.
fixed cvs tree, testcase in new/finalfield/* The fix involved a minor change to org.aspectj.weaver.AjcMemberMaker.makePublic to makePublicNonFinal This means that all introduced fields are always implemented with a non-final field in the target class. The compiler's checking rules still operate on the inter-type declaration which remains final. The test case was extended to ensure that this checking still works to signal errors when final fields are assigned to.