Bug 43883 - Compile fails on Win2k but works on Linux box
Summary: Compile fails on Win2k but works on Linux box
Status: RESOLVED INVALID
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.1.1   Edit
Hardware: PC Windows 2000
: P4 normal (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-29 21:39 EDT by kasi gaadu CLA
Modified: 2004-03-18 13:00 EST (History)
2 users (show)

See Also:


Attachments
Test Aspect which has the static variable (1.49 KB, text/plain)
2003-09-29 21:40 EDT, kasi gaadu CLA
no flags Details
RMI interface (233 bytes, text/plain)
2003-09-29 21:43 EDT, kasi gaadu CLA
no flags Details
RMI Server / implementation (1.33 KB, text/plain)
2003-09-29 21:44 EDT, kasi gaadu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description kasi gaadu CLA 2003-09-29 21:39:13 EDT
Hi,
   I have a RMI server program which sets a static variable value in my aspect 
dynamically. The program does not compile when run on Win2K box. But, the same 
program(s) compile perfectly (and I could run it as well) on RedHat Linux8.0. 

I am attaching my test programs to this bug report. 

The Compilation errors are: 

--------------------------------------------------------------------------------
C:\proj\FirstAspect\first\aspect\SetMethodImpl.java:26 The method setMethodName
(String) is undefined for the type Test
tstObj.setMethodName(method);
       ^^^^^^^^^^^^^
C:\proj\FirstAspect\first\aspect\SetMethodImpl.java:28 tstObj.methodName cannot 
be resolved or is not a field
System.out.println("MethodName: " + tstObj.methodName);
                                    ^^^^^^^^^^^^^^^^^

2 errors

--------------------------------------------------------------------------------
Comment 1 kasi gaadu CLA 2003-09-29 21:40:14 EDT
Created attachment 6280 [details]
Test Aspect which has the static variable
Comment 2 kasi gaadu CLA 2003-09-29 21:43:28 EDT
Created attachment 6281 [details]
RMI interface
Comment 3 kasi gaadu CLA 2003-09-29 21:44:03 EDT
Created attachment 6282 [details]
RMI Server / implementation
Comment 4 Matthew Webster CLA 2003-11-10 08:16:18 EST
The sample as supplied won't compile. This is because the SetMethodImpl 
constructor is trying to directly instantiate the aspect Test which gives the 
following error:

	The constructor Test() is not visible

The fact that you were able to get past this and fail later plus the fact that 
you get different behaviour in differnet environments leads me to believe that 
this is a configuration problem i.e. that you have another version of Test on 
your classpath.

Another observation is the invocation of a static method using an instance is 
generally frowned upon. You should use the class instead i.e.

    Test.methodName()

This would obviate the need to obtain an instance of the aspect.

Jim I recommend closing this bug.
Comment 5 Jim Hugunin CLA 2004-03-18 13:00:19 EST
I agree with Matthew's analysis and I'm marking this invalid.  You shouldn't 
be able to directly call the constructor of an aspect.  The fact that this 
works on one system suggests a configuration problem.  You can fix your 
program by removing the "new Test()" constructor call.  If the error persists 
after this fix, please reopen the bug.