Bug 35593 - Problem with priviliged aspects
Summary: Problem with priviliged aspects
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Jim Hugunin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-24 14:03 EST by Mohamed Mansour CLA
Modified: 2003-04-10 16:38 EDT (History)
0 users

See Also:


Attachments
Source code to reproduce the problem (10.00 KB, application/octet-stream)
2003-03-24 14:06 EST, Mohamed Mansour CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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