Community
Participate
Working Groups
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 --------------------------------------------------------------------------------
Created attachment 6280 [details] Test Aspect which has the static variable
Created attachment 6281 [details] RMI interface
Created attachment 6282 [details] RMI Server / implementation
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.
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.