Bug 35593

Summary: Problem with priviliged aspects
Product: [Tools] AspectJ Reporter: Mohamed Mansour <mansour>
Component: CompilerAssignee: Jim Hugunin <jim-aj>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Source code to reproduce the problem none

Description Mohamed Mansour CLA 2003-03-24 14:03:31 EST
I am writing an aspect with a pointcut before execution of a method in a
non-public class in a different package. 

When I compile with aspectj1.1rc1 I get the following error message:
> 
> TraceAspect.java:15 The type edu.gatech.Argument is not visible for the
> argument t of the method ajc$before$TraceAspect$1b1
> before (edu.gatech.Argument t): execution (* *(edu.gatech.Argument)) &&
> args(t) {
>        ^^^^^^^^^^^^^^^^^^^
> 
> 1 error

Source code used:
----------- TraceAspect.java
import edu.gatech.*;

privileged aspect TraceAspect {
   pointcut myTrace(): within(TraceAspect);
   pointcut javaCode(): within(java..*) || call(* java..*(..));

   // a point cut that matches any static method call.
   pointcut methodExec(): 
          call(* *(..)) 
          && !javaCode()
          && !myTrace();
  before (edu.gatech.Argument t): execution (* *(edu.gatech.Argument)) && args(t) {
  }
}
----------- source code (edu/gatech/Main.java)
package edu.gatech;


class Argument {
  public int a;
  public String b;
};

public class Main {
   public static void foo(Argument t) {
   }
   public static void main(String []args) {
        Argument t = new Argument(); 
        foo(t);
 }
}
---------------
Comment 1 Mohamed Mansour CLA 2003-03-24 14:06:44 EST
Created attachment 4327 [details]
Source code to reproduce the problem

To reproduce the problem:
- untar the attached file
- cd bug35593/src
- Edit the makefile and set your Java path correctly
- Type make from the command line
Comment 2 Jim Hugunin CLA 2003-04-10 14:38:46 EDT
This is fixed in the current tree and tested by extending an existing 
privileged test for a variety of argument positions.

It was very easy to reproduce this test case from the supplied code.  For your 
future reference, the short example that you provided in the text of the bug 
report is much more useful than the attachment.  attachments are most useful 
when the test case is very complicated.  Reducing the test case to two short 
self-contained files like you did is the most useful option.
Comment 3 Jim Hugunin CLA 2003-04-10 16:38:17 EDT
Changing status to fixed