]> source.dussan.org Git - aspectj.git/commitdiff
mavenizing org.aspectj.lib - wip
authorAndy Clement <aclement@pivotal.io>
Fri, 1 Feb 2019 20:38:49 +0000 (12:38 -0800)
committerAndy Clement <aclement@pivotal.io>
Fri, 1 Feb 2019 20:38:49 +0000 (12:38 -0800)
19 files changed:
org.aspectj.lib/.cvsignore [deleted file]
org.aspectj.lib/.project [deleted file]
org.aspectj.lib/pom.xml [new file with mode: 0644]
org.aspectj.lib/src/main/java/org/aspectj/lib/pointcuts/Pointcuts.java [new file with mode: 0644]
org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPoints.java [new file with mode: 0644]
org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPointsBase.java [new file with mode: 0644]
org.aspectj.lib/src/org/aspectj/lib/pointcuts/Pointcuts.java [deleted file]
org.aspectj.lib/src/org/aspectj/lib/tracing/TraceJoinPoints.java [deleted file]
org.aspectj.lib/src/org/aspectj/lib/tracing/TraceJoinPointsBase.java [deleted file]
org.aspectj.lib/src/test/java/org/aspectj/lib/LibModuleTests.java [new file with mode: 0644]
org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTest.java [new file with mode: 0644]
org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTests.java [new file with mode: 0644]
org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TraceJoinPointsTest.java [new file with mode: 0644]
org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TracingTests.java [new file with mode: 0644]
org.aspectj.lib/testsrc/org/aspectj/lib/LibModuleTests.java [deleted file]
org.aspectj.lib/testsrc/org/aspectj/lib/pointcuts/PointcutsTest.java [deleted file]
org.aspectj.lib/testsrc/org/aspectj/lib/pointcuts/PointcutsTests.java [deleted file]
org.aspectj.lib/testsrc/org/aspectj/lib/tracing/TraceJoinPointsTest.java [deleted file]
org.aspectj.lib/testsrc/org/aspectj/lib/tracing/TracingTests.java [deleted file]

diff --git a/org.aspectj.lib/.cvsignore b/org.aspectj.lib/.cvsignore
deleted file mode 100644 (file)
index 432f06c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-.generated.lst
-.generated.ajsym
-bin
diff --git a/org.aspectj.lib/.project b/org.aspectj.lib/.project
deleted file mode 100644 (file)
index 06769d2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.aspectj.lib</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.ajdt.core.ajbuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.ajdt.ui.ajnature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/org.aspectj.lib/pom.xml b/org.aspectj.lib/pom.xml
new file mode 100644 (file)
index 0000000..d90092a
--- /dev/null
@@ -0,0 +1,25 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.aspectj</groupId>
+    <artifactId>aspectj-parent</artifactId>
+    <version>1.9.3.BUILD-SNAPSHOT</version>
+    <relativePath>..</relativePath>
+  </parent>
+
+  <artifactId>runtime</artifactId>
+  <packaging>jar</packaging>
+  <name>runtime</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>testing-util</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/org.aspectj.lib/src/main/java/org/aspectj/lib/pointcuts/Pointcuts.java b/org.aspectj.lib/src/main/java/org/aspectj/lib/pointcuts/Pointcuts.java
new file mode 100644 (file)
index 0000000..fd96bf9
--- /dev/null
@@ -0,0 +1,183 @@
+/* *******************************************************************
+ * Copyright (c) 2003-2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Common Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/cpl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg     initial implementation 
+ * ******************************************************************/
+
+// START-SAMPLE library-pointcutIdioms Standard pointcut idioms 
+package org.aspectj.lib.pointcuts;
+
+import java.util.Collection;
+import java.io.PrintStream;
+
+/**
+ * Library of pointcut idioms to use in combination with
+ * other pointcuts.
+ * 
+ * @author Wes Isberg
+ */
+public final class Pointcuts {
+
+    // ------- not staticly-determinable
+    public pointcut adviceCflow() : cflow(adviceexecution());
+
+    public pointcut notInAdviceCflow() : !adviceCflow();
+
+    public pointcut cflowMainExecution() :
+        cflow(mainExecution());
+
+    // ------- staticly-determinable
+
+    public pointcut mainExecution() :
+        execution(public static void main(String[]));
+        
+    /** staticly-determinable to never match any join point */
+    public pointcut never();
+    
+    public pointcut afterAdviceSupported() : !handler(*);
+
+    public pointcut aroundAdviceSupported() : !handler(*)
+        && !initialization(new(..)) && !preinitialization(new(..));
+
+    public pointcut anyMethodExecution() : 
+        execution(* *(..));
+
+    public pointcut anyPublicMethodExecution() : 
+        execution(public * *(..));
+
+    public pointcut anyPackageProtectedMethodExecution() : 
+        execution(!private !public !protected * *(..));
+
+    public pointcut anyNonPrivateMethodExecution() : 
+        execution(!private * *(..));
+
+    public pointcut anyConstructorExecution() : 
+        execution(new(..));
+
+    public pointcut anyPublicConstructorExecution() : 
+        execution(public new(..));
+
+    public pointcut anyNonPrivateConstructorExecution() :
+        execution(!private new(..));
+
+    public pointcut anyPublicFieldGet() : 
+        get(public * *);
+
+    public pointcut anyNonPrivateFieldGet() : 
+        get(!private * *);
+
+    public pointcut anyPublicFieldSet() : 
+        set(public * *);
+
+    public pointcut anyNonPrivateFieldSet() : 
+        set(!private * *); // also !transient?
+
+    public pointcut withinSetter() :  // require !static?
+        withincode(void set*(*)); // use any return type? multiple parms?
+
+    public pointcut withinGetter() : 
+        withincode(!void get*()); // permit parms? require !static?
+    
+    public pointcut anyNonPublicFieldSetOutsideConstructorOrSetter() : 
+        set(!public * *) && !withincode(new(..)) 
+        && !withinSetter();
+
+    public pointcut anyRunnableImplementation() :
+        staticinitialization(Runnable+);
+
+    public pointcut anyGetSystemErrOut() :
+        get(PrintStream System.err) || get(PrintStream System.out);
+
+    public pointcut anySetSystemErrOut() :
+        call(void System.setOut(..)) || call(void System.setErr(..));
+    
+    public pointcut withinAnyJavaCode() :
+        within(java..*) || within(javax..*);
+
+    public pointcut notWithinJavaCode() :
+        !withinAnyJavaCode();
+
+    public pointcut toStringExecution() :
+        execution(String toString()) && !within(String);
+
+    /** call or execution of any Thread constructor, including subclasses */
+    public pointcut anyThreadConstruction() :
+        call(Thread+.new(..)) || execution(Thread+.new(..));
+
+    /** 
+     * Any calls to java.io classes 
+     * (but not methods declared only on their subclasses).
+     */
+    public pointcut anyJavaIOCalls() :
+        call(* java.io..*.*(..)) || call(java.io..*.new(..));
+
+    /** 
+     * Any calls to java.awt or javax.swing methods or constructors 
+     * (but not methods declared only on their subclasses).
+     */
+    public pointcut anyJavaAWTOrSwingCalls() :
+        call(* java.awt..*.*(..)) || call(java.awt..*.new(..))
+        || call(* javax.swing..*.*(..)) || call(javax.swing..*.new(..));
+
+    public pointcut cloneImplementationsInNonCloneable() :
+        execution(Object !Cloneable+.clone());
+        
+    public pointcut runImplementationsInNonRunnable() :
+        execution(void !Runnable+.run());
+        
+    /** any calls to java.lang.reflect or Class.get* (except getName()) */
+    public pointcut anySystemReflectiveCalls() :
+        call(* java.lang.reflect..*.*(..))
+        || (!call(* Class.getName())
+            && call(* Class.get*(..)));
+
+    /** standard class-loading calls by Class and ClassLoader
+     * Note that `Foo.class` in bytecode is `Class.forName("Foo")`,
+     * so 'Foo.class' will also be picked out by this pointcut.
+     */
+    public pointcut anySystemClassLoadingCalls() :
+        call(Class Class.forName(..))
+        || call(Class ClassLoader.loadClass(..));
+
+    public pointcut anySystemProcessSpawningCalls() :
+        call(Process Runtime.exec(..))
+        || call(Class ClassLoader.loadClass(..));
+
+    /** Write methods on Collection
+     * Warning: Does not pick out <code>iterator()</code>, even though
+     * an Iterator can remove elements.
+     */
+    public pointcut anyCollectionWriteCalls() :
+        call(boolean Collection+.add(Object)) 
+        || call(boolean Collection+.addAll(Collection)) 
+        || call(void Collection+.clear())
+        || call(boolean Collection+.remove(Object))
+        || call(boolean Collection+.removeAll(Collection))
+        || call(boolean Collection+.retainAll(Collection));
+        
+    public pointcut mostThrowableReadCalls() :
+        call(* Throwable+.get*(..))
+        || call(* Throwable+.print*(..))
+        || call(String Throwable+.toString(..));
+
+    public pointcut exceptionWrappingCalls() :
+        (args(Throwable+,..) || args(.., Throwable+))
+        && (set(Throwable+ Throwable+.*)
+            || (call(* Throwable+.*(..)) 
+                || call(Throwable+.new(..))));
+
+    public pointcut anyCodeThrowingException() :
+        execution(* *(..) throws Exception+)
+            || execution(new(..) throws Exception+);
+            
+    private Pointcuts() {} 
+}
+//END-SAMPLE library-pointcutIdioms
+
+
diff --git a/org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPoints.java b/org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPoints.java
new file mode 100644 (file)
index 0000000..6d6f592
--- /dev/null
@@ -0,0 +1,142 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg       initial implementation 
+ * ******************************************************************/
+
+// START-SAMPLE tracing-traceJoinPoints Trace join points executed to log
+
+package org.aspectj.lib.tracing;
+
+import org.aspectj.lang.*;
+import org.aspectj.lang.reflect.*;
+import java.io.*;
+
+/**
+ * Print join points being executed in context to a log.xml file.
+ * To use this, define the abstract pointcuts in a subaspect.
+ * @author Jim Hugunin, Wes Isberg
+ */
+public abstract aspect TraceJoinPoints 
+    extends TraceJoinPointsBase {
+
+    // abstract protected pointcut entry();
+    
+    PrintStream out;
+    int logs = 0;
+    int depth = 0;
+    boolean terminal = false;
+
+    /**
+     * Emit a message in the log, e.g.,
+     * <pre>TraceJoinPoints tjp = TraceJoinPoints.aspectOf();
+     * if (null != tjp) tjp.message("Hello, World!");</pre>
+     */
+    public void message(String s) {
+        out.println("<message>" + prepareMessage(s) + "</message>");
+    }
+
+    protected void startLog() {
+        makeLogStream();
+    }
+    
+    protected void completeLog() {
+        closeLogStream();
+    }
+    
+    protected void logEnter(JoinPoint.StaticPart jp) {
+        if (terminal) out.println(">");
+        indent(depth);
+        out.print("<" + jp.getKind());
+        writeSig(jp);
+        writePos(jp);
+
+        depth += 1;
+        terminal = true;
+    }
+    
+    protected void logExit(JoinPoint.StaticPart jp) {
+        depth -= 1;
+        if (terminal) {
+            getOut().println("/>");
+        } else {
+            indent(depth);
+            getOut().println("</" + jp.getKind() + ">");
+        }
+        terminal = false;
+    }
+    
+    protected PrintStream getOut() {
+        if (null == out) {
+            String m = "not in the control flow of entry()";
+            throw new IllegalStateException(m);
+        }
+        return out;
+    }
+
+    protected void makeLogStream() {
+        try {
+            String name = "log" + logs++ + ".xml";
+            out = new PrintStream(new FileOutputStream(name));
+        } catch (IOException ioe) {
+            out = System.err;
+        }
+    }
+
+    protected void closeLogStream() {
+        PrintStream out = this.out;
+        if (null != out) {
+            out.close();
+            // this.out = null;
+        }
+    }
+
+    /** @return input String formatted for XML */
+    protected String prepareMessage(String s) {  // XXX unimplemented
+        return s; 
+    } 
+    
+    void message(String sink, String s) {
+        if (null == sink) {
+            message(s);
+        } else {
+            getOut().println("<message sink=" + quoteXml(sink)
+                        + " >" + prepareMessage(s) + "</message>");
+        }
+    }
+    
+    void writeSig(JoinPoint.StaticPart jp) {
+        PrintStream out = getOut();
+        out.print(" sig=");
+        out.print(quoteXml(jp.getSignature().toShortString()));
+    }
+
+    void writePos(JoinPoint.StaticPart jp) {
+        SourceLocation loc = jp.getSourceLocation();
+        if (loc == null) return;
+        PrintStream out = getOut();
+
+        out.print(" pos=");
+        out.print(quoteXml(loc.getFileName() +
+                           ":" + loc.getLine() +
+                           ":" + loc.getColumn()));
+    }
+
+    protected String quoteXml(String s) { // XXX weak
+        return "\"" + s.replace('<', '_').replace('>', '_') + "\"";
+    }
+
+    protected void indent(int i) {
+        PrintStream out = getOut();
+        while (i-- > 0) out.print("  ");
+    }
+}
+// END-SAMPLE tracing-traceJoinPoints        
+
+          
\ No newline at end of file
diff --git a/org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPointsBase.java b/org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPointsBase.java
new file mode 100644 (file)
index 0000000..989c298
--- /dev/null
@@ -0,0 +1,70 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg       initial implementation 
+ * ******************************************************************/
+
+// START-SAMPLE tracing-traceJoinPoints Trace join points executed   
+
+package org.aspectj.lib.tracing;
+
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * Trace join points being executed in context.
+ * To use this, define the abstract members in a subaspect.
+ * <b>Warning</b>: this does not trace join points that do not
+ * support after advice.
+ * @author Jim Hugunin, Wes Isberg
+ */
+abstract aspect TraceJoinPointsBase {
+
+    declare precedence : TraceJoinPointsBase, *;
+
+    abstract protected pointcut entry();
+
+    /** ignore join points outside this scope - use within(..) */
+    abstract protected pointcut withinScope();
+
+    protected pointcut exit(): withinScope() && call(* java..*.*(..));
+
+    final pointcut start(): withinScope() && entry() && !cflowbelow(entry());
+
+    final pointcut trace(): withinScope() && cflow(entry()) 
+        && !cflowbelow(exit()) && !within(TraceJoinPointsBase+);
+
+    private pointcut supportsAfterAdvice() : !handler(*)
+        && !preinitialization(new(..));
+
+    before(): start() { startLog(); }
+
+    before(): trace() && supportsAfterAdvice(){ 
+        logEnter(thisJoinPointStaticPart); 
+    }
+
+    after(): trace() && supportsAfterAdvice() { 
+        logExit(thisJoinPointStaticPart); 
+    }
+
+    after(): start() { completeLog(); }
+    
+    abstract protected void logEnter(JoinPoint.StaticPart jp);
+
+    abstract protected void logExit(JoinPoint.StaticPart jp);
+    
+    /** called before any logging */
+    abstract protected void startLog();
+    
+    /** called after any logging */
+    abstract protected void completeLog();
+}
+
+// END-SAMPLE tracing-traceJoinPoints        
+
+          
\ No newline at end of file
diff --git a/org.aspectj.lib/src/org/aspectj/lib/pointcuts/Pointcuts.java b/org.aspectj.lib/src/org/aspectj/lib/pointcuts/Pointcuts.java
deleted file mode 100644 (file)
index fd96bf9..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2003-2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Common Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/cpl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg     initial implementation 
- * ******************************************************************/
-
-// START-SAMPLE library-pointcutIdioms Standard pointcut idioms 
-package org.aspectj.lib.pointcuts;
-
-import java.util.Collection;
-import java.io.PrintStream;
-
-/**
- * Library of pointcut idioms to use in combination with
- * other pointcuts.
- * 
- * @author Wes Isberg
- */
-public final class Pointcuts {
-
-    // ------- not staticly-determinable
-    public pointcut adviceCflow() : cflow(adviceexecution());
-
-    public pointcut notInAdviceCflow() : !adviceCflow();
-
-    public pointcut cflowMainExecution() :
-        cflow(mainExecution());
-
-    // ------- staticly-determinable
-
-    public pointcut mainExecution() :
-        execution(public static void main(String[]));
-        
-    /** staticly-determinable to never match any join point */
-    public pointcut never();
-    
-    public pointcut afterAdviceSupported() : !handler(*);
-
-    public pointcut aroundAdviceSupported() : !handler(*)
-        && !initialization(new(..)) && !preinitialization(new(..));
-
-    public pointcut anyMethodExecution() : 
-        execution(* *(..));
-
-    public pointcut anyPublicMethodExecution() : 
-        execution(public * *(..));
-
-    public pointcut anyPackageProtectedMethodExecution() : 
-        execution(!private !public !protected * *(..));
-
-    public pointcut anyNonPrivateMethodExecution() : 
-        execution(!private * *(..));
-
-    public pointcut anyConstructorExecution() : 
-        execution(new(..));
-
-    public pointcut anyPublicConstructorExecution() : 
-        execution(public new(..));
-
-    public pointcut anyNonPrivateConstructorExecution() :
-        execution(!private new(..));
-
-    public pointcut anyPublicFieldGet() : 
-        get(public * *);
-
-    public pointcut anyNonPrivateFieldGet() : 
-        get(!private * *);
-
-    public pointcut anyPublicFieldSet() : 
-        set(public * *);
-
-    public pointcut anyNonPrivateFieldSet() : 
-        set(!private * *); // also !transient?
-
-    public pointcut withinSetter() :  // require !static?
-        withincode(void set*(*)); // use any return type? multiple parms?
-
-    public pointcut withinGetter() : 
-        withincode(!void get*()); // permit parms? require !static?
-    
-    public pointcut anyNonPublicFieldSetOutsideConstructorOrSetter() : 
-        set(!public * *) && !withincode(new(..)) 
-        && !withinSetter();
-
-    public pointcut anyRunnableImplementation() :
-        staticinitialization(Runnable+);
-
-    public pointcut anyGetSystemErrOut() :
-        get(PrintStream System.err) || get(PrintStream System.out);
-
-    public pointcut anySetSystemErrOut() :
-        call(void System.setOut(..)) || call(void System.setErr(..));
-    
-    public pointcut withinAnyJavaCode() :
-        within(java..*) || within(javax..*);
-
-    public pointcut notWithinJavaCode() :
-        !withinAnyJavaCode();
-
-    public pointcut toStringExecution() :
-        execution(String toString()) && !within(String);
-
-    /** call or execution of any Thread constructor, including subclasses */
-    public pointcut anyThreadConstruction() :
-        call(Thread+.new(..)) || execution(Thread+.new(..));
-
-    /** 
-     * Any calls to java.io classes 
-     * (but not methods declared only on their subclasses).
-     */
-    public pointcut anyJavaIOCalls() :
-        call(* java.io..*.*(..)) || call(java.io..*.new(..));
-
-    /** 
-     * Any calls to java.awt or javax.swing methods or constructors 
-     * (but not methods declared only on their subclasses).
-     */
-    public pointcut anyJavaAWTOrSwingCalls() :
-        call(* java.awt..*.*(..)) || call(java.awt..*.new(..))
-        || call(* javax.swing..*.*(..)) || call(javax.swing..*.new(..));
-
-    public pointcut cloneImplementationsInNonCloneable() :
-        execution(Object !Cloneable+.clone());
-        
-    public pointcut runImplementationsInNonRunnable() :
-        execution(void !Runnable+.run());
-        
-    /** any calls to java.lang.reflect or Class.get* (except getName()) */
-    public pointcut anySystemReflectiveCalls() :
-        call(* java.lang.reflect..*.*(..))
-        || (!call(* Class.getName())
-            && call(* Class.get*(..)));
-
-    /** standard class-loading calls by Class and ClassLoader
-     * Note that `Foo.class` in bytecode is `Class.forName("Foo")`,
-     * so 'Foo.class' will also be picked out by this pointcut.
-     */
-    public pointcut anySystemClassLoadingCalls() :
-        call(Class Class.forName(..))
-        || call(Class ClassLoader.loadClass(..));
-
-    public pointcut anySystemProcessSpawningCalls() :
-        call(Process Runtime.exec(..))
-        || call(Class ClassLoader.loadClass(..));
-
-    /** Write methods on Collection
-     * Warning: Does not pick out <code>iterator()</code>, even though
-     * an Iterator can remove elements.
-     */
-    public pointcut anyCollectionWriteCalls() :
-        call(boolean Collection+.add(Object)) 
-        || call(boolean Collection+.addAll(Collection)) 
-        || call(void Collection+.clear())
-        || call(boolean Collection+.remove(Object))
-        || call(boolean Collection+.removeAll(Collection))
-        || call(boolean Collection+.retainAll(Collection));
-        
-    public pointcut mostThrowableReadCalls() :
-        call(* Throwable+.get*(..))
-        || call(* Throwable+.print*(..))
-        || call(String Throwable+.toString(..));
-
-    public pointcut exceptionWrappingCalls() :
-        (args(Throwable+,..) || args(.., Throwable+))
-        && (set(Throwable+ Throwable+.*)
-            || (call(* Throwable+.*(..)) 
-                || call(Throwable+.new(..))));
-
-    public pointcut anyCodeThrowingException() :
-        execution(* *(..) throws Exception+)
-            || execution(new(..) throws Exception+);
-            
-    private Pointcuts() {} 
-}
-//END-SAMPLE library-pointcutIdioms
-
-
diff --git a/org.aspectj.lib/src/org/aspectj/lib/tracing/TraceJoinPoints.java b/org.aspectj.lib/src/org/aspectj/lib/tracing/TraceJoinPoints.java
deleted file mode 100644 (file)
index 6d6f592..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg       initial implementation 
- * ******************************************************************/
-
-// START-SAMPLE tracing-traceJoinPoints Trace join points executed to log
-
-package org.aspectj.lib.tracing;
-
-import org.aspectj.lang.*;
-import org.aspectj.lang.reflect.*;
-import java.io.*;
-
-/**
- * Print join points being executed in context to a log.xml file.
- * To use this, define the abstract pointcuts in a subaspect.
- * @author Jim Hugunin, Wes Isberg
- */
-public abstract aspect TraceJoinPoints 
-    extends TraceJoinPointsBase {
-
-    // abstract protected pointcut entry();
-    
-    PrintStream out;
-    int logs = 0;
-    int depth = 0;
-    boolean terminal = false;
-
-    /**
-     * Emit a message in the log, e.g.,
-     * <pre>TraceJoinPoints tjp = TraceJoinPoints.aspectOf();
-     * if (null != tjp) tjp.message("Hello, World!");</pre>
-     */
-    public void message(String s) {
-        out.println("<message>" + prepareMessage(s) + "</message>");
-    }
-
-    protected void startLog() {
-        makeLogStream();
-    }
-    
-    protected void completeLog() {
-        closeLogStream();
-    }
-    
-    protected void logEnter(JoinPoint.StaticPart jp) {
-        if (terminal) out.println(">");
-        indent(depth);
-        out.print("<" + jp.getKind());
-        writeSig(jp);
-        writePos(jp);
-
-        depth += 1;
-        terminal = true;
-    }
-    
-    protected void logExit(JoinPoint.StaticPart jp) {
-        depth -= 1;
-        if (terminal) {
-            getOut().println("/>");
-        } else {
-            indent(depth);
-            getOut().println("</" + jp.getKind() + ">");
-        }
-        terminal = false;
-    }
-    
-    protected PrintStream getOut() {
-        if (null == out) {
-            String m = "not in the control flow of entry()";
-            throw new IllegalStateException(m);
-        }
-        return out;
-    }
-
-    protected void makeLogStream() {
-        try {
-            String name = "log" + logs++ + ".xml";
-            out = new PrintStream(new FileOutputStream(name));
-        } catch (IOException ioe) {
-            out = System.err;
-        }
-    }
-
-    protected void closeLogStream() {
-        PrintStream out = this.out;
-        if (null != out) {
-            out.close();
-            // this.out = null;
-        }
-    }
-
-    /** @return input String formatted for XML */
-    protected String prepareMessage(String s) {  // XXX unimplemented
-        return s; 
-    } 
-    
-    void message(String sink, String s) {
-        if (null == sink) {
-            message(s);
-        } else {
-            getOut().println("<message sink=" + quoteXml(sink)
-                        + " >" + prepareMessage(s) + "</message>");
-        }
-    }
-    
-    void writeSig(JoinPoint.StaticPart jp) {
-        PrintStream out = getOut();
-        out.print(" sig=");
-        out.print(quoteXml(jp.getSignature().toShortString()));
-    }
-
-    void writePos(JoinPoint.StaticPart jp) {
-        SourceLocation loc = jp.getSourceLocation();
-        if (loc == null) return;
-        PrintStream out = getOut();
-
-        out.print(" pos=");
-        out.print(quoteXml(loc.getFileName() +
-                           ":" + loc.getLine() +
-                           ":" + loc.getColumn()));
-    }
-
-    protected String quoteXml(String s) { // XXX weak
-        return "\"" + s.replace('<', '_').replace('>', '_') + "\"";
-    }
-
-    protected void indent(int i) {
-        PrintStream out = getOut();
-        while (i-- > 0) out.print("  ");
-    }
-}
-// END-SAMPLE tracing-traceJoinPoints        
-
-          
\ No newline at end of file
diff --git a/org.aspectj.lib/src/org/aspectj/lib/tracing/TraceJoinPointsBase.java b/org.aspectj.lib/src/org/aspectj/lib/tracing/TraceJoinPointsBase.java
deleted file mode 100644 (file)
index 989c298..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg       initial implementation 
- * ******************************************************************/
-
-// START-SAMPLE tracing-traceJoinPoints Trace join points executed   
-
-package org.aspectj.lib.tracing;
-
-import org.aspectj.lang.JoinPoint;
-
-/**
- * Trace join points being executed in context.
- * To use this, define the abstract members in a subaspect.
- * <b>Warning</b>: this does not trace join points that do not
- * support after advice.
- * @author Jim Hugunin, Wes Isberg
- */
-abstract aspect TraceJoinPointsBase {
-
-    declare precedence : TraceJoinPointsBase, *;
-
-    abstract protected pointcut entry();
-
-    /** ignore join points outside this scope - use within(..) */
-    abstract protected pointcut withinScope();
-
-    protected pointcut exit(): withinScope() && call(* java..*.*(..));
-
-    final pointcut start(): withinScope() && entry() && !cflowbelow(entry());
-
-    final pointcut trace(): withinScope() && cflow(entry()) 
-        && !cflowbelow(exit()) && !within(TraceJoinPointsBase+);
-
-    private pointcut supportsAfterAdvice() : !handler(*)
-        && !preinitialization(new(..));
-
-    before(): start() { startLog(); }
-
-    before(): trace() && supportsAfterAdvice(){ 
-        logEnter(thisJoinPointStaticPart); 
-    }
-
-    after(): trace() && supportsAfterAdvice() { 
-        logExit(thisJoinPointStaticPart); 
-    }
-
-    after(): start() { completeLog(); }
-    
-    abstract protected void logEnter(JoinPoint.StaticPart jp);
-
-    abstract protected void logExit(JoinPoint.StaticPart jp);
-    
-    /** called before any logging */
-    abstract protected void startLog();
-    
-    /** called after any logging */
-    abstract protected void completeLog();
-}
-
-// END-SAMPLE tracing-traceJoinPoints        
-
-          
\ No newline at end of file
diff --git a/org.aspectj.lib/src/test/java/org/aspectj/lib/LibModuleTests.java b/org.aspectj.lib/src/test/java/org/aspectj/lib/LibModuleTests.java
new file mode 100644 (file)
index 0000000..6a666b2
--- /dev/null
@@ -0,0 +1,29 @@
+package org.aspectj.lib;
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg       initial implementation 
+ * ******************************************************************/
+
+// default package
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class LibModuleTests extends TestCase {
+
+    public static Test suite() { 
+        TestSuite suite = new TestSuite(LibModuleTests.class.getName());
+        suite.addTest(org.aspectj.lib.pointcuts.PointcutsTests.suite()); 
+        suite.addTest(org.aspectj.lib.tracing.TracingTests.suite()); 
+        return suite;
+    }
+
+}  
diff --git a/org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTest.java b/org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTest.java
new file mode 100644 (file)
index 0000000..7cc082a
--- /dev/null
@@ -0,0 +1,60 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg       initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.lib.pointcuts;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ */
+public class PointcutsTest extends TestCase {
+
+    public void test_anyPublicMethodExecution() {
+        try {
+            Test_anyPublicMethodExecution.error();
+            assertTrue("no exception thrown", false);
+        } catch (Error e) {
+            // ok, advice worked
+        }
+    }
+    
+    private static aspect Test_anyPublicMethodExecution {
+        public static void error() {
+            throw new RuntimeException("wrong exception");
+        }
+        
+        static void nonpublic() {}
+        
+        before() : 
+            execution(static void Test_anyPublicMethodExecution.error()) 
+            && Pointcuts.anyPublicMethodExecution() {
+            throw new Error("");
+        }
+        
+        declare error : 
+            execution(static void Test_anyPublicMethodExecution.nonpublic()) 
+            && Pointcuts.anyPublicMethodExecution() 
+            : "anyPublicMethodExecution failed - not public";
+        
+    }
+    private static aspect compileChecks {
+        /** balk if Pointcuts has code - s.b. only pointcuts */
+        declare error : within(Pointcuts) && 
+            (set(* *) || Pointcuts.anyMethodExecution() || 
+                    (Pointcuts.anyConstructorExecution()
+                            && !execution(private Pointcuts.new()))) :
+                "only pointcuts permitted in Pointcuts";
+
+        
+    }
+}
diff --git a/org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTests.java b/org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTests.java
new file mode 100644 (file)
index 0000000..3844804
--- /dev/null
@@ -0,0 +1,31 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg       initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.lib.pointcuts;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class PointcutsTests extends TestCase {
+
+    public static Test suite() { 
+        TestSuite suite = new TestSuite(PointcutsTests.class.getName());
+        //$JUnit-BEGIN$
+        suite.addTestSuite(PointcutsTest.class); 
+        //$JUnit-END$
+        return suite;
+    }
+
+    public PointcutsTests(String name) { super(name); }
+
+}  
diff --git a/org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TraceJoinPointsTest.java b/org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TraceJoinPointsTest.java
new file mode 100644 (file)
index 0000000..75b27d4
--- /dev/null
@@ -0,0 +1,83 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg       initial implementation 
+ * ******************************************************************/
+
+
+package org.aspectj.lib.tracing;
+
+import junit.framework.TestCase;
+
+import org.aspectj.lang.JoinPoint.StaticPart;
+
+/**
+ * 
+ */
+public class TraceJoinPointsTest extends TestCase {
+
+    public void testTraceJoinPoints() {
+        checkTjp();
+        TestTJP aspect = TestTJP.aspectOf();
+        assertNotNull("aspect", aspect);
+        assertTrue("checked", aspect.checked);
+    }
+
+    static final int NUMJP = 1;
+    
+    static void checkTjp() {
+        // NUMJP: only 1 join point
+        long l = System.currentTimeMillis();
+    }
+
+    /** poor design/test */
+    static aspect TestTJP extends TraceJoinPoints  {
+       
+        protected pointcut withinScope() : within(TraceJoinPointsTest)
+            && !within(TestTJP);
+        pointcut traceJoinPoints() :
+            execution(static void TraceJoinPointsTest.testTraceJoinPoints());
+
+        protected pointcut entry() : 
+            execution(static void TraceJoinPointsTest.checkTjp());
+
+        boolean checked;
+        int logEnter = 10;
+        int logExit = 10;
+        int startLog = 10;
+        int completeLog = 10;
+        protected void logEnter(StaticPart jp) {
+            logEnter++;
+        }
+
+        protected void logExit(StaticPart jp) {
+            logExit++;
+        }
+        
+        protected void startLog() {
+            startLog = 0;
+            completeLog = 0;
+            logEnter = 0;
+            logExit = 0;
+            startLog++;
+        }
+        
+        protected void completeLog() {
+            completeLog++;
+        }
+        after() returning : entry() {
+            assertEquals("startLog", 1, startLog);
+            assertEquals("completeLog", 1, startLog);
+            assertEquals("logExit", NUMJP, startLog);
+            assertEquals("logEntry", NUMJP, startLog);
+            assertTrue(!checked);
+            checked = true;
+        }
+    }
+}
diff --git a/org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TracingTests.java b/org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TracingTests.java
new file mode 100644 (file)
index 0000000..9f4daaf
--- /dev/null
@@ -0,0 +1,29 @@
+/* *******************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Eclipse Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://eclipse.org/legal/epl-v10.html 
+ *  
+ * Contributors: 
+ *     Wes Isberg       initial implementation 
+ * ******************************************************************/
+
+package org.aspectj.lib.tracing;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class TracingTests extends TestCase {
+
+    public static Test suite() { 
+        TestSuite suite = new TestSuite(TracingTests.class.getName());
+        //$JUnit-BEGIN$
+        suite.addTestSuite(TraceJoinPointsTest.class); 
+        //$JUnit-END$
+        return suite;
+    }
+
+}  
diff --git a/org.aspectj.lib/testsrc/org/aspectj/lib/LibModuleTests.java b/org.aspectj.lib/testsrc/org/aspectj/lib/LibModuleTests.java
deleted file mode 100644 (file)
index 6a666b2..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.aspectj.lib;
-/* *******************************************************************
- * Copyright (c) 2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg       initial implementation 
- * ******************************************************************/
-
-// default package
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class LibModuleTests extends TestCase {
-
-    public static Test suite() { 
-        TestSuite suite = new TestSuite(LibModuleTests.class.getName());
-        suite.addTest(org.aspectj.lib.pointcuts.PointcutsTests.suite()); 
-        suite.addTest(org.aspectj.lib.tracing.TracingTests.suite()); 
-        return suite;
-    }
-
-}  
diff --git a/org.aspectj.lib/testsrc/org/aspectj/lib/pointcuts/PointcutsTest.java b/org.aspectj.lib/testsrc/org/aspectj/lib/pointcuts/PointcutsTest.java
deleted file mode 100644 (file)
index 7cc082a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg       initial implementation 
- * ******************************************************************/
-
-package org.aspectj.lib.pointcuts;
-
-import junit.framework.TestCase;
-
-/**
- * 
- */
-public class PointcutsTest extends TestCase {
-
-    public void test_anyPublicMethodExecution() {
-        try {
-            Test_anyPublicMethodExecution.error();
-            assertTrue("no exception thrown", false);
-        } catch (Error e) {
-            // ok, advice worked
-        }
-    }
-    
-    private static aspect Test_anyPublicMethodExecution {
-        public static void error() {
-            throw new RuntimeException("wrong exception");
-        }
-        
-        static void nonpublic() {}
-        
-        before() : 
-            execution(static void Test_anyPublicMethodExecution.error()) 
-            && Pointcuts.anyPublicMethodExecution() {
-            throw new Error("");
-        }
-        
-        declare error : 
-            execution(static void Test_anyPublicMethodExecution.nonpublic()) 
-            && Pointcuts.anyPublicMethodExecution() 
-            : "anyPublicMethodExecution failed - not public";
-        
-    }
-    private static aspect compileChecks {
-        /** balk if Pointcuts has code - s.b. only pointcuts */
-        declare error : within(Pointcuts) && 
-            (set(* *) || Pointcuts.anyMethodExecution() || 
-                    (Pointcuts.anyConstructorExecution()
-                            && !execution(private Pointcuts.new()))) :
-                "only pointcuts permitted in Pointcuts";
-
-        
-    }
-}
diff --git a/org.aspectj.lib/testsrc/org/aspectj/lib/pointcuts/PointcutsTests.java b/org.aspectj.lib/testsrc/org/aspectj/lib/pointcuts/PointcutsTests.java
deleted file mode 100644 (file)
index 3844804..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg       initial implementation 
- * ******************************************************************/
-
-package org.aspectj.lib.pointcuts;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class PointcutsTests extends TestCase {
-
-    public static Test suite() { 
-        TestSuite suite = new TestSuite(PointcutsTests.class.getName());
-        //$JUnit-BEGIN$
-        suite.addTestSuite(PointcutsTest.class); 
-        //$JUnit-END$
-        return suite;
-    }
-
-    public PointcutsTests(String name) { super(name); }
-
-}  
diff --git a/org.aspectj.lib/testsrc/org/aspectj/lib/tracing/TraceJoinPointsTest.java b/org.aspectj.lib/testsrc/org/aspectj/lib/tracing/TraceJoinPointsTest.java
deleted file mode 100644 (file)
index 75b27d4..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg       initial implementation 
- * ******************************************************************/
-
-
-package org.aspectj.lib.tracing;
-
-import junit.framework.TestCase;
-
-import org.aspectj.lang.JoinPoint.StaticPart;
-
-/**
- * 
- */
-public class TraceJoinPointsTest extends TestCase {
-
-    public void testTraceJoinPoints() {
-        checkTjp();
-        TestTJP aspect = TestTJP.aspectOf();
-        assertNotNull("aspect", aspect);
-        assertTrue("checked", aspect.checked);
-    }
-
-    static final int NUMJP = 1;
-    
-    static void checkTjp() {
-        // NUMJP: only 1 join point
-        long l = System.currentTimeMillis();
-    }
-
-    /** poor design/test */
-    static aspect TestTJP extends TraceJoinPoints  {
-       
-        protected pointcut withinScope() : within(TraceJoinPointsTest)
-            && !within(TestTJP);
-        pointcut traceJoinPoints() :
-            execution(static void TraceJoinPointsTest.testTraceJoinPoints());
-
-        protected pointcut entry() : 
-            execution(static void TraceJoinPointsTest.checkTjp());
-
-        boolean checked;
-        int logEnter = 10;
-        int logExit = 10;
-        int startLog = 10;
-        int completeLog = 10;
-        protected void logEnter(StaticPart jp) {
-            logEnter++;
-        }
-
-        protected void logExit(StaticPart jp) {
-            logExit++;
-        }
-        
-        protected void startLog() {
-            startLog = 0;
-            completeLog = 0;
-            logEnter = 0;
-            logExit = 0;
-            startLog++;
-        }
-        
-        protected void completeLog() {
-            completeLog++;
-        }
-        after() returning : entry() {
-            assertEquals("startLog", 1, startLog);
-            assertEquals("completeLog", 1, startLog);
-            assertEquals("logExit", NUMJP, startLog);
-            assertEquals("logEntry", NUMJP, startLog);
-            assertTrue(!checked);
-            checked = true;
-        }
-    }
-}
diff --git a/org.aspectj.lib/testsrc/org/aspectj/lib/tracing/TracingTests.java b/org.aspectj.lib/testsrc/org/aspectj/lib/tracing/TracingTests.java
deleted file mode 100644 (file)
index 9f4daaf..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2005 Contributors.
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Eclipse Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://eclipse.org/legal/epl-v10.html 
- *  
- * Contributors: 
- *     Wes Isberg       initial implementation 
- * ******************************************************************/
-
-package org.aspectj.lib.tracing;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-public class TracingTests extends TestCase {
-
-    public static Test suite() { 
-        TestSuite suite = new TestSuite(TracingTests.class.getName());
-        //$JUnit-BEGIN$
-        suite.addTestSuite(TraceJoinPointsTest.class); 
-        //$JUnit-END$
-        return suite;
-    }
-
-}