Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] ajc versus javac

It used to be an error to use an unadorned name that could refer to
either an inherited member or a variable in an enclosing scope. The
language spec has been changed, if I recall correctly, so that now it
refers to the inherited member. javac 1.3 and below will give the same
error as ajc. javac 1.4+ will accept the code.

Personally I prefer the old behaviour. It's really bad form to do
shadowing like this.

David Holmes

> -----Original Message-----
> From: aspectj-users-admin@xxxxxxxxxxx
> [mailto:aspectj-users-admin@xxxxxxxxxxx]On Behalf Of Nuno Oliveira
> Sent: Wednesday, 24 September 2003 10:27 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] ajc versus javac
>
>
> Thanks for answering. Then shouldn't it be caugth by javac ?
>
> -----Original Message-----
> From: Maneesh Chaturvedi [mailto:Maneesh.Chaturvedi@xxxxxxxxxxxx]
> Sent: Wednesday, September 24, 2003 1:05 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] ajc versus javac
>
>
> Its a case of variable shadowing
>
> -----Original Message-----
> From: Nuno Oliveira [mailto:noliveira@xxxxxx]
> Sent: Wednesday, September 24, 2003 3:48 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] ajc versus javac
>
>
> I have an abstract class with a public field 'result' and
> an abstract method
> whose core for the context of my question is:
>
> public abstract class myclass
> {
> 	public Boolean result;
>
> 	public abstract void task();
> }
>
> I have a piece of code that looks more or less like this
>
> void method()
> {
> 	int result;
>
> 	myclass mc = new myclass(){
> 		public void task(){
> 			result = new Boolean(false); // error line
> 		}
> 	}
> }
>
> javac compiles this succefully. However, running ajc on it
> gives me the
> error message "The field result is defined in an inherithed
> type and an
> enclosing type" in the line mentioned above.
>
> Can anyone shed some light on what's going on ? Is this an
> invalid idiom or
> is it an ajc compiling bug ? I'm using ajc1.1.1 and jsdk1.4.0_01.
>
> Thanks.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>



Back to the top