Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Weaving into more classes than it should?

Hi Andy,

That makes sense with the error message. I've also tried with the
-Xlint:ignore switch and it worked! (and indeed, I'm pretty sure those
classes shouldn't be touched)

Thank you very much!

Cheers,
Tiago

On Tue, Feb 8, 2011 at 3:51 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
> Hi,
>
> The message is unfortunately a bit misleading, it says:
>
>> ---------------------8<-------------------------------
>> C:\glassfishv3\glassfish\modules\webservices-osgi.jar [error] can't
>> determine superclass of missing type org.apache.tools.ant.Task
>> when weaving type com.sun.xml.ws.installer.UpdateSharedLoaderProp
>> when weaving classes
>> when weaving
>> when batch building BuildConfig[null] #Files=1 AopXmls=#0
>>  [Xlint:cantFindType]
>> (no source information available)
>>        [Xlint:cantFindType]
>> ---------------------8<-------------------------------
>
> But what it means instead of 'when weaving' is 'when matching and
> possibly weaving'.  It means it is performing analysis on some types
> to see if they might match (maybe they subclass ServletAdapter)  - it
> can't see the entire supertype chain because a superclass is missing.
> Now, these messages are Xlint, so they can be turned off if you are
> confident that you don't care about those missing types.  The option
> -Xlint:ignore will switch them off.
>
> Andy
>
>
> On 8 February 2011 02:59, Tiago Espinha <tiago@xxxxxxxxxx> wrote:
>> Hi all,
>>
>> I have a JAR that comes with GlassFish (webservices-osgi.jar) and
>> within this jar, there's a class by the name of
>> com.sun.xml.ws.transport.http.servlet.ServletAdapter.
>>
>> What I'm trying to do is to capture all executions of the method
>> handle() within this class, so that means ServletAdapter.handle(...).
>>
>> The thing is, I have the following aspect (which I've tried to strip
>> to barebones):
>> ---------------------8<-------------------------------
>> import java.io.BufferedReader;
>> import java.io.InputStreamReader;
>> import java.io.OutputStreamWriter;
>> import java.net.URL;
>> import java.net.URLConnection;
>> import java.net.URLEncoder;
>> import java.util.Calendar;
>>
>> import javax.servlet.ServletContext;
>> import javax.servlet.http.HttpServletRequest;
>> import javax.servlet.http.HttpServletResponse;
>>
>> public aspect SoapAspect {
>>        pointcut handlerInvoked() :
>>                 execution(public void
>> com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletContext,
>> HttpServletRequest, HttpServletResponse))
>>                 && target(com.sun.xml.ws.transport.http.servlet.ServletAdapter);
>>           before() : handlerInvoked()
>>           {
>>                //(...)
>>           }
>> }
>> ---------------------8<-------------------------------
>>
>> And whenever I try to weave this simple aspect into the JAR, I get a
>> few dozen errors about it not being able to determine the supertype of
>> classes that aren't even related to the class I'm weaving. Here's an
>> example of one of such errors (there's 34 in total):
>> ---------------------8<-------------------------------
>> C:\glassfishv3\glassfish\modules\webservices-osgi.jar [error] can't
>> determine superclass of missing type org.apache.tools.ant.Task
>> when weaving type com.sun.xml.ws.installer.UpdateSharedLoaderProp
>> when weaving classes
>> when weaving
>> when batch building BuildConfig[null] #Files=1 AopXmls=#0
>>  [Xlint:cantFindType]
>> (no source information available)
>>        [Xlint:cantFindType]
>> ---------------------8<-------------------------------
>>
>> You can have a look at the ServletAdapter class here
>> (http://www.docjar.com/html/api/com/sun/xml/ws/transport/http/servlet/ServletAdapter.java.html)
>> and see that there's no reference whatsoever to either Task or
>> UpdateSharedLoaderProp.
>>
>> Am I missing something stupidly obvious in AspectJ? I thought whenever
>> I weaved an aspect with the "execution()" pointcut, I would just be
>> touching the target class; so if that's the case, why is ajc trying to
>> weave into other random classes?
>>
>> Thanks in advance!
>>
>> Tiago
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top