Community
Participate
Working Groups
Hi-, I am trying to perform binary weaving on a JAR (me_org.geotools-2.0.jar) that contains some unresolved imports, with some compiled aspects (me_exceedsoft.aspects-1.0.jar). Since this is not AJC's business at all, I try to prevent AJC from complaining (with noimporterror = "true"): ------------------------------------------ ajc [-g, -verbose, -warn:-unusedImport, -target, 1.2, -XlazyTjp, - preserveAllLocals, -outjar, C:\projects\marketedge\build\netbeans\modules\me_org.geotools-2.0.jar, - classpath, C:\projects\marketedge\build\classes;C:\projects\marketedge\netbeans\modules\me _com.vividsolutions.jts- 1.4.0.jar;C:\projects\marketedge\netbeans\modules\me_exceedsoft.aspects- 1.0.jar;C:\projects\marketedge\netbeans\modules\me_exceedsoft.map- 1.0.jar;C:\projects\marketedge\netbeans\modules\me_javax.units- 0.01.jar;C:\projects\marketedge\netbeans\modules\me_javax.vectmath- 1.3.jar;C:\projects\marketedge\netbeans\modules\me_org.apache.batik- 1.5.1.jar;C:\projects\marketedge\netbeans\modules\me_org.garret.perst- 230.jar;C:\projects\marketedge\netbeans\modules\me_org.geotools- 2.0.jar;C:\projects\marketedge\netbeans\modules\me_org.geotools.shp- 2.0.jar;C:\projects\marketedge\netbeans\modules\me_org.geotools.tiger- 2.0.jar;C:\projects\marketedge\netbeans\modules\me_org.opengis- 1.1.jar;C:\java\netbeans-3_6-platform\lib\core.jar;C:\java\netbeans-3_6- platform\lib\ext\boot.jar;C:\java\netbeans-3_6-platform\lib\openide- loaders.jar;C:\java\netbeans-3_6-platform\lib\openide.jar;C:\java\netbeans-3_6- platform\lib\updater.jar;C:\java\netbeans-3_6-platform\modules\autoload\core- output.jar;C:\java\netbeans-3_6-platform\modules\autoload\core- settings.jar;C:\java\netbeans-3_6-platform\modules\autoload\ext\jh- 2.0_01.jar;C:\java\netbeans-3_6-platform\modules\autoload\javahelp- api.jar;C:\java\netbeans-3_6-platform\modules\autoload\openide- io.jar;C:\java\netbeans-3_6- platform\modules\autoload\terminalemulator.jar;C:\java\netbeans-3_6- platform\modules\autoupdate.jar;C:\java\netbeans-3_6-platform\modules\core- ui.jar;C:\java\netbeans-3_6-platform\modules\core-windows.jar;C:\java\netbeans- 3_6- platform\modules\text.jar;C:\java\aspectj\lib\aspectjrt.jar;C:\java\aspectj\lib \aspectjtools.jar;C:\java\junit\junit.jar, -aspectpath, C:\projects\marketedge\netbeans\modules\me_exceedsoft.aspects-1.0.jar, - inpath, C:\projects\marketedge\netbeans\modules\me_org.geotools-2.0.jar] zipfile classpath entry does not exist: C:\java\j2sdk1.4\jre\lib\i18n.jar directory classpath entry does not exist: C:\java\j2sdk1.4\jre\classes C:\projects\marketedge\netbeans\modules\me_org.geotools-2.0.jar error can't find type org.opengis.pt.PT_Matrix (no source information available) C:\projects\marketedge\netbeans\modules\me_org.geotools-2.0.jar error can't find type org.opengis.pt.PT_CoordinatePoint (no source information available) ... <and so on for 399 more warnings> --------------------------------------------- but without any success - it keeps emitting warnings, regardless if "noimporterror" is set to "true" or "false". If I try to prevent the ANT build from from failing (with failonerror = "false") AJC produces garbage JARs (with lots of non-.class stuff missing). Thanks, Hristo P.S: Let me know if you need the source JARS - they are kind of big, but still ...
Hi Hristo, The messages you are getting out 'cant find type' are not quite the same as unresolved imports. I believe unresolved imports would make a difference if you were compiling from source and had some 'import XXX' statements where XXX couldn't be found. When binary weaving, 'cant find type' occurs when the weaver is looking for some types in order to do its job. See bug 44191 which has already been raised for the poor message 'cant find type' Anyway, an example. Suppose you specify a pointcut match something like: pointcut p(): call(* someMethod(..)) && this(Foo); where the only type you have passed to the weaver is a subtype of Foo. In order to do correct type analysis and determine if the pointcut matches, the weaver wants to have Foo accessible. It doesnt necessarily want to weave into it, it just wants it around whilst it examines the subclass. What you typically do in these situations is put Foo on the classpath when calling the aspectj compiler. Types on the classpath can be referenced by the weaver but are not candidates for weaving themselves. In your case, you should put entries on the classpath for the Ant call that you put on the classpath when you built me_org.geotools-2.0.jar and me_exceedsoft.aspects-1.0.jar. It looks like you need to put the jar containing org.opengis.pt.* on the classpath for the iajc call. If we didn't put out the message and silently continued you might find that you hadn't woven the places you expected because the weaver hadn't had all the type information around.
I'm going to close this as a dup of bug 44191 which is the bug related to 'cant find type' messages - I hope to get to 44191 soon. It could be that some of the 'cant find type' messages that are currently being reported as errors may be relatively harmless (as bug 44191 says, there are about 60 routes into the 'cant find type' logic) - and so these may get downgraded to warnings or ignores. *** This bug has been marked as a duplicate of 44191 ***
Fix released as part of AspectJ 1.2.1