Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Compile-time erros and warnings

Thanks Vincent. That resolved my problem.

Best Regards,
Hugo Magalhães

>-----Original Message-----
>From: Jorrand, Vincent [mailto:vincent.jorrand@xxxxxxxxxxxxxx]
>Sent: Quarta-feira, 9 de Abril de 2003 15:40
>To: 'aspectj-users@xxxxxxxxxxx'
>Subject: RE: [aspectj-users] Compile-time erros and warnings
>
>
>System.out is a static attribute of the System class and 
>call(* X.y(..))
>cannot work in for it. In addition even if it did your 
>pointcut could not
>catch something like:
>	PrintStream myOut = System.out;
>	myOut.println("hello world");
>
>The usual solution is to block the access to the out attribute:
>	declare error: get(java.io.PrintStream System.out) &&
>within(com.mypackage..*)
>
>Vincent
>
>-----Original Message-----
>From: Hugo Magalhães [mailto:Hugo.Magalhaes@xxxxxxxxxxx]
>Sent: Wednesday, April 09, 2003 10:21 AM
>To: aspectj-users@xxxxxxxxxxx
>Subject: [aspectj-users] Compile-time erros and warnings
>
>
>Good afternoon.
>
>I'm trying to create a compile time Aspect to do a warning when the
>System.out.print() and System.out.println() is called from 
>anywhere in my
>code but that doesn't seem to work and a warning symbol shows 
>up on the left
>side of the poincut (line 3) (I'm using Eclipse 2.1, Aspect 
>1.1 and AJDT
>0.6.1). Can you tell me what I'm doing wrong? 
>
>The code is the following:
>
>----------------------------------------------
>
>- Aspect:
>
>1. public aspect SystemOutListener {
>2.				
>3.	pointcut systemOut() 
>4.		: call( * System.out.*(..)) && within(com.mypackage.*);
>5.		
>6.	declare error: systemOut()
>7.		: "You cannot use System.out.print* directy. Use the Log
>class instead";
>8.			
>8. }
>
>-----------------------------------------------
>
>- Main class:
>
>package com.mypackage;
>
>1. public class Main {
>2.	
>3.	 public Main () {
>4.		
>5.		System.out.println("Error");
>6.		
>7.	 }
>8.
>9.	 public static void main(String[] args) {
>10.		
>11.		new Main ();
>12.		
>13.	 }
>14. }
>
>-----------------------------------------------
>
>Thanks in advance,
>Hugo Magalhães 
>_______________________________________________
>aspectj-users mailing list
>aspectj-users@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
>***************************************************************
>***********
>The information transmitted herewith is sensitive information 
>intended only
>for use by the individual or entity to which it is addressed. 
>If the reader
>of this message is not the intended recipient, you are hereby 
>notified that
>any review, retransmission, dissemination, distribution, 
>copying or other
>use of, or taking of any action in reliance upon this information is
>strictly prohibited. If you have received this communication in error,
>please contact the sender and delete the material from your computer.
>_______________________________________________
>aspectj-users mailing list
>aspectj-users@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top