Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Re: aspectj-users Digest, Vol 34, Issue 22

Pois eu cheguei à mesma conclusão ontem à noite. Contudo se eu definir o aspecto da seguinte forma

------------------------------
---------------------------------------------
package declare_question;


Client.java:
public class Client {
       public Client(){
               System.out.println("Client constructed");
       }

   public static void main(String[] args) {
       Ola o = new Client();
   }
}
---------------------------------------------------------------------------
package declare_question;

protected interface Ola {}
public aspect X {
       declare parents: Client implements Ola;
}
---------------------------------------------------------------------------

ou seja, tirando a interface Ola duma classe separada e pondo-a dentro do aspecto depois ele já dá erro na frame "Problems". Não estou a conseguir definir a interface dentro do aspecto.

On Dec 14, 2007 2:18 PM, Miguel Pessoa Monteiro <mmonteiro@xxxxxxxxxxxxx> wrote:
I apologise for that message in portuguese, I thought that I was sending only to
Renato.

Miguel P. Monteiro


Em Sex, Dezembro 14, 2007 2:15 pm, Miguel Pessoa  Monteiro escreveu:
> Renato, só depois de te enviar a msg anterior reparei que este diálogo sobre declare
> era teu. Reproduzi o teu exemplo no meu sistema e de facto surge um erro assinalado
> no editor. Porém, esse erro não surge na frame "Problems" em baixo. É apenas um erro
> do editor, não tem efeito prático.~
>
> Se adaptares o exemplo de modo que possa correr, constatas que o programa executa.
> Com erros do compilador "a sério", não executaria.
>
> Só para ilustrar, construí o seguinte:
> ---------------------------------------------------------------------------
> package declare_question;
>
> public interface Ola {
>
> }
> ---------------------------------------------------------------------------
> package declare_question;
>
>
> Client.java:
> public class Client {
>       public Client(){
>               System.out.println("Client constructed");
>       }
>
>     public static void main(String[] args) {
>         Ola o = new Client();
>     }
> }
> ---------------------------------------------------------------------------
> package declare_question;
>
> public aspect X {
>       declare parents: Client implements Ola;
> }
> ---------------------------------------------------------------------------
>
>
> Quando corro o programa, surge "Client constructed" na consola.
> O "Run as" funciona, quer eu especifique "Java Application" ou "AspectJ/Java
> Application".
>
> mpm
>
>
> Em Sex, Dezembro 14, 2007 5:20 am, aspectj-users-request@xxxxxxxxxxx escreveu:
>> Send aspectj-users mailing list submissions to
>>      aspectj-users@xxxxxxxxxxx
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>       https://dev.eclipse.org/mailman/listinfo/aspectj-users
>> or, via email, send a message with subject or body 'help' to
>>      aspectj-users-request@xxxxxxxxxxx
>>
>> You can reach the person managing the list at
>>      aspectj-users-owner@xxxxxxxxxxx
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of aspectj-users digest..."
>>
>>
>> Today's Topics:
>>
>>    1. Re: declare question (Renato Rodrigues)
>>    2. RE: AspectJ loadtime weaving on WebSphere 5 (Ron Bodkin)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Fri, 14 Dec 2007 00:38:02 +0000
>> From: "Renato Rodrigues" < renatolmsrodrigues@xxxxxxxxx>
>> Subject: Re: [aspectj-users] declare question
>> To: aspectj-users@xxxxxxxxxxx
>> Message-ID:
>>      <6bca87da0712131638h61e16892u58e265827ffe20a6@xxxxxxxxxxxxxx>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> i just discovered that when i build the project manually it doesn't give any
>> error but eclipse always signals the error in because if its automatic
>> build. but since this is an aspectj project shouldnt the auto build be
>> compiling aspectj? More, shouldn't the builds be the same?
>>
>> On Dec 14, 2007 12:31 AM, Renato Rodrigues <renatolmsrodrigues@xxxxxxxxx >
>> wrote:
>>
>>> I already had the interface Ola if that's what you mean, i just forgot to
>>> write it here.
>>> I have AspectJ 1.5
>>>
>>> I could make this work if i create an aspect and put all the code in the
>>> same aspect but if i try to separate in 3 different classes
>>>
>>> if i put this code in one aspect it works
>>>     interface Ola {}
>>>
>>>     class Client {
>>>
>>>         public Client(){}
>>>
>>>            public void aux() {
>>>                Ola o = new Client();
>>>            }
>>>         }
>>>         public aspect X {
>>>
>>>           declare parents: Client implements Ola;
>>>         }
>>>
>>> but if create an aspect X, an interface Ola and a class Client it doesn't
>>> work... i can't understand why
>>>
>>> I tried cleaning the project but the same happened.
>>>
>>>
>>> On Dec 13, 2007 11:44 PM, Andy Clement < andrew.clement@xxxxxxxxx> wrote:
>>>
>>> > You wouldn't need the cast compiling this java:
>>> >
>>> > interface Ola {}
>>> > class Client implements Ola {
>>> >    public void aux() {
>>> >        Ola o = new Client();
>>> >    }
>>> > }
>>> >
>>> > So you don't need the cast if you pull out the implements into an
>>> > aspect:
>>> >
>>> > interface Ola {}
>>> > class Client {
>>> >    public void aux() {
>>> >        Ola o = new Client();
>>> >    }
>>> > }
>>> > aspect X {
>>> >   declare parents: Client implements Ola;
>>> > }
>>> >
>>> > Since the type hierarchy is entirely consistent for this program once
>>> > the declare parents has been applied.
>>> >
>>> > If you are doing a fresh compile from source, the code above will be
>>> > fine.  There are some issues with incremental compilation and interype
>>> > declarations like the declare parents statement - to see if that is what is
>>> > affecting you, do a project clean - does it now compile cleanly?
>>> >
>>> > The only time the above set of declarations wont work together is if you
>>> > compiled pieces of the program separately, for example compiling Ola and
>>> > Client without the aspect - that would require the cast.
>>> >
>>> > Did you try putting the code I included in a source file to see if that
>>> > works for you?  What level of AspectJ/AJDT are you on, the latest?
>>> >
>>> > In reply to Bhaskar
>>> >
>>> > > I have seen the type cast error happen to me a couple of times before,
>>> > > I never verified if it was due to the eager parsing by the editor the
>>> > > typecast seemed to make sense to me and I put it in there.
>>> >
>>> > If you are in the AspectJ Editor for the files, that editor is aware of
>>> > intertype declarations.  If you see this problem in that case then it may be
>>> > an incremental compilation problem - which, as I mentioned above, we can
>>> > determine by doing a project clean and observing whether the problem
>>> > vanishes.
>>> >
>>> >
>>> > Andy.
>>> >
>>> > On 13/12/2007, Renato Rodrigues < renatolmsrodrigues@xxxxxxxxx > wrote:
>>> > >
>>> > > For me it only works if i do the cast Bhaskar Maddala suggested.Isthis
>>> normal?
>>> > >
>>> > >
>>> > >
>>> > > I'm within an eclipse project so i just save and it compiles alone.
>>> > > Didn't understand your question, sorry.
>>> > >
>>> > > If i defined the aspect like :
>>> > >
>>> > > aspect example{
>>> > >
>>> > >    public interface Ola{};
>>> > >     declare parents: Client implements Ola;
>>> > >
>>> > > }
>>> > >
>>> > > and still continue with the same code in class Client is it normal
>>> > > that it gives and error saying  "Ola cannot be resolved to a type"
>>> > >
>>> > > On Dec 13, 2007 9:06 PM, Andy Clement < andrew.clement@xxxxxxxxx>
>>> > > wrote:
>>> > >
>>> > > > I'm not quite sure what you are doing, but that program compiles
>>> > > > fine for me:
>>> > > >
>>> > > > ---- Client.java ---- 8<----
>>> > > > interface Ola {}
>>> > > >
>>> > > > public class Client {
>>> > > >    Client(){};
>>> > > >
>>> > > >    public int num1(){
>>> > > >        return 1;
>>> > > >    }
>>> > > >
>>> > > >    public void aux()
>>> > > >    {
>>> > > >        Ola o = new Client();
>>> > > >    }
>>> > > > }
>>> > > >
>>> > > >  aspect example{
>>> > > >
>>> > > >
>>> > > >     declare parents: Client implements Ola;
>>> > > >
>>> > > > }
>>> > > > ---- Client.java ---- 8<----
>>> > > >
>>> > > > C:\aspectj1.5-dev>ajc -showWeaveInfo Client.java
>>> > > > Extending interface set for type 'Client' ( Client.java) to include
>>> > > > 'Ola' (Client.java)
>>> > > >
>>> > > > Are you compiling all from source? are you binary weaving in some
>>> > > > way?
>>> > > > it should be fine.  You *might* get a eager parsing bug in the
>>> > > > eclipse
>>> > > > editor as it isnt aware the aspect will make everything alright at
>>> > > > compile time?
>>> > > >
>>> > > > Andy.
>>> > > >
>>> > > > On 13/12/2007, Renato Rodrigues < renatolmsrodrigues@xxxxxxxxx>
>>> > > > wrote:
>>> > > > > Im a newbie to AspectJ and i'm trying to do a simple declare
>>> > > > parents
>>> > > > > _expression_ so a Class can implement an interface
>>> > > > >
>>> > > > > i have class:
>>> > > > >
>>> > > > >
>>> > > > > public class Client {
>>> > > > >     Client(){};
>>> > > > >
>>> > > > >     public int num1(){
>>> > > > >         return 1;
>>> > > > >     }
>>> > > > >
>>> > > > >     public void aux()
>>> > > > >     {
>>> > > > >         Ola o = new Client();
>>> > > > >     }
>>> > > > > }
>>> > > > > and aspect :
>>> > > > >
>>> > > > >
>>> > > > > public aspect example{
>>> > > > >
>>> > > > >
>>> > > > >      declare parents: Client implements Ola;
>>> > > > >
>>> > > > > }
>>> > > > >
>>> > > > >
>>> > > > > and the compiler says Type mismatch: cannot convert from Client to
>>> > > > Ola
>>> > > > >
>>> > > > > _______________________________________________
>>> > > > > 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
>>> > > >
>>> > >
>>> > >
>>> > > _______________________________________________
>>> > > 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
>>> >
>>> >
>>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users/attachments/20071213/36b0c951/attachment.html
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Thu, 13 Dec 2007 21:20:19 -0800
>> From: Ron Bodkin <rbodkin@xxxxxxxxxxxxxx>
>> Subject: RE: [aspectj-users] AspectJ loadtime weaving on WebSphere 5
>> To: < aspectj-users@xxxxxxxxxxx>
>> Message-ID: <00b301c83e11$06321210$12963630$@newaspects.com>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> Hi Hermod,
>>
>>
>>
>> Yes Glassbox does have a few 1.4 runtime dependencies in it. But you could
>> still use the packaged installation script it includes on an older VM. It
>> generates output like this:
>>
>>
>>
>> JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:$JAVA_14_HOME/java14Adapter.jar
>> -Xbootclasspath/a:$JAVA_14_HOME/createJavaAdapter.jar:$JAVA_14_HOME/aspectj1
>> 4Adapter.jar:C:\devel\tool\apache software
>> foundation\apache-tomcat-4.1.34-LE-jdk14/common/lib/aspectjweaver.jar
>> -Xmx509m
>> -Daspectwerkz.classloader.preprocessor=org.aspectj.ext.ltw13.ClassPreProcess
>> orAdapter ."
>>
>>
>>
>> Where it ran the command java -jar createJavaAdapter.jar to produce
>> aspectj14Adapter.jar
>>
>>
>>
>> From: aspectj-users-bounces@xxxxxxxxxxx
>> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of
>> hermod.opstvedt@xxxxxxxxx
>> Sent: Tuesday, December 11, 2007 3:54 AM
>> To: aspectj-users@xxxxxxxxxxx
>> Subject: RE: [aspectj-users] AspectJ loadtime weaving on WebSphere 5
>>
>>
>>
>> Hi
>>
>>
>>
>> The latest glassbox has 1.4 dependencies:
>> java.net.URLDecoder.decode(String), java.net.SocketAdress
>>
>>
>>
>> Hermod
>>
>> -----Original Message-----
>> From: aspectj-users-bounces@xxxxxxxxxxx
>> [mailto: aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
>> Sent: Monday, December 10, 2007 9:21 PM
>> To: hermod@xxxxxxxxxxxx ; aspectj-users@xxxxxxxxxxx
>> Subject: RE: [aspectj-users] AspectJ loadtime weaving on WebSphere 5
>>
>> There are some problems in the IBM classloader plugin approach; it doesn't
>> tell the plugin what loader is being used and it also doesn't set the
>> context loader correctly in some cases. I've seen this result in defining
>> classes in the wrong loader, leading to NoClassDefFoundErrors. It is also
>> possible this issue is leading to the lockup behavior you are seeing.
>>
>>
>>
>> I'd suggest trying the alternative approach of generating a bootstrap
>> classpath jar that adds a weaving hook to ClassLoader. The Glassbox
>> <http://www.glassbox.com/>  project has an automated installer and updated
>> version of the code based on Alex Vasseur's blog entry and the last
>> Aspectwerkz release.
>>
>>
>>
>> Ron
>>
>>
>>
>> From: aspectj-users-bounces@xxxxxxxxxxx
>> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Hermod Opstvedt
>> Sent: Sunday, December 09, 2007 7:22 AM
>> To: aspectj-users@xxxxxxxxxxx
>> Subject: [aspectj-users] AspectJ loadtime weaving on WebSphere 5
>>
>>
>>
>> Hi
>>
>> I have had waeving on WAS 5.0.2 working with the Ron's WasWeavingPlugin, but
>> for some reason it stopped working (I do not know that I have doen anything
>> to it). WebSphere hangs on startup during initialization of the Admin
>> application (Last entry in log is admin: init). If I take out the Admin
>> application it does start however. As far as I have been able to track down
>> looking at the logs, it seems to be connected with Tiles. I have seen others
>> having the same situation, but have not seen ant entry stating that they
>> have solved the issue.
>>
>> So: Anybody have this working?
>>
>> Hermod
>>
>> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>>
>> This email with attachments is solely for the use of the individual or
>> entity to whom it is addressed. Please also be aware that the DnB NOR Group
>> cannot accept any payment orders or other legally binding correspondence
>> with
>> customers as a part of an email.
>>
>> This email message has been virus checked by the anti virus programs used
>> in the DnB NOR Group.
>>
>> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users/attachments/20071214/3e4362d9/attachment.html
>>
>> ------------------------------
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>>
>> End of aspectj-users Digest, Vol 34, Issue 22
>> *********************************************
>>
>
>
> --
> Miguel P. Monteiro          | cell phone +351 96 700 35 45
> Departamento de Informatica | Phone +351 21 294 8536 ext. 10708
> Faculdade Ciencias e Tecnol.| Fax: +351 21 294 8541
> Universidade Nova de Lisboa | URL: http://ctp.di.fct.unl.pt/~mpm
> 2829-516 Caparica, PORTUGAL | e-mail: mmonteiro [at] di fct unl pt
>


--
Miguel P. Monteiro          | cell phone +351 96 700 35 45
Departamento de Informatica | Phone +351 21 294 8536 ext. 10708
Faculdade Ciencias e Tecnol.| Fax: +351 21 294 8541
Universidade Nova de Lisboa | URL: http://ctp.di.fct.unl.pt/~mpm
2829-516
Caparica, PORTUGAL | e-mail: mmonteiro [at] di fct unl pt

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top