diff options
161 files changed, 2220 insertions, 4184 deletions
diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..b76b89570 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 546d4286b..f731a47ee 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -12,18 +12,26 @@ on: jobs: build: - runs-on: ubuntu-latest + # No automatic builds for Dependabot PRs + # Caveat: cannot start 'if:' expression with '!', hence '!= true' + if: startsWith(github.actor, 'dependabot') != true + strategy: fail-fast: false matrix: - java: [ 11, 14, 17 ] + # TODO: switch from 18-ea to 18, as soon as Temurin offers the download on https://adoptium.net/releases.html + java: [ 11, 17, 18-ea ] + + runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up JDK ${{ matrix.java }} - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: java-version: ${{ matrix.java }} + distribution: temurin - name: Print tool versions run: | @@ -31,8 +39,58 @@ jobs: ./mvnw -B --version ant -version + - name: Set up cache for ~./m2/repository + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository + !~/.m2/repository/org/aspectj + key: maven-${{ runner.os }}-java-${{ matrix.java }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + maven-${{ runner.os }}-java-${{ matrix.java }}- + maven-${{ runner.os }}- + maven- + - name: Compile + package code - run: ./mvnw -B --file pom.xml -DskipTests package + # Also install (not just package) for subsequent build steps + run: ./mvnw -B --file pom.xml -DskipTests install + + - name: Attach aspectjrt to build + uses: actions/upload-artifact@v3 + with: + name: aspectjrt-java${{ matrix.java }} + # Binary, source, javadoc JARs + flattened POM + path: | + aspectjrt/target/aspectjrt-*.jar + aspectjrt/target/flattened-pom.xml + + - name: Attach aspectjweaver to build + uses: actions/upload-artifact@v3 + with: + name: aspectjweaver-java${{ matrix.java }} + # Binary, source, javadoc JARs + flattened POM + path: | + aspectjweaver/target/aspectjweaver-*.jar + aspectjweaver/target/flattened-pom.xml + + - name: Attach aspectjtools to build + uses: actions/upload-artifact@v3 + with: + name: aspectjtools-java${{ matrix.java }} + # Binary, source, javadoc JARs + flattened POM + path: | + aspectjtools/target/aspectjtools-*.jar + aspectjtools/target/flattened-pom.xml + + - name: Create docs + run: ./mvnw -B --file pom.xml -DskipTests process-resources -pl docs -P create-docs + + - name: Attach docs to build + uses: actions/upload-artifact@v3 + with: + name: aspectj-docs-java${{ matrix.java }} + # Re-zip docs directory instead of wrapping existing distribution archive into another zip archive + path: aj-build/dist/docs/ - name: Run Tests # Tests in module ajde call Swing/AWT classes. Without frame buffer they throw @@ -45,6 +45,7 @@ Ensure you run this with a JDK - the more recent the better since some tests wil * [Getting started with AspectJ](https://www.eclipse.org/aspectj/doc/released/progguide/starting.html) * [Programming Guide](https://www.eclipse.org/aspectj/doc/released/progguide/index.html) * [READMEs for each version of AspectJ](docs/dist/doc) +* [AspectJ Java version compatibility](docs/dist/doc/JavaVersionCompatibility.md) ## Documentation for AspectJ developers diff --git a/ajbrowser/AJBrowser.jpx b/ajbrowser/AJBrowser.jpx deleted file mode 100644 index 9a0e5f415..000000000 --- a/ajbrowser/AJBrowser.jpx +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-
-<!--JBuilder XML Project-->
-<project>
- <property category="sys" name="BackupPath" value="bak" />
- <property category="sys" name="CheckStable" value="1" />
- <property category="sys" name="Company" value="" />
- <property category="sys" name="Copyright" value="Copyright (c) 2002" />
- <property category="sys" name="Description" value="" />
- <property category="sys" name="DocPath" value="doc" />
- <property category="sys" name="ExcludeClassEnabled" value="0" />
- <property category="sys" name="JDK" value="java 1.3.0_02" />
- <property category="sys" name="LastTag" value="0" />
- <property category="sys" name="Libraries" value="" />
- <property category="sys" name="MakeStable" value="0" />
- <property category="sys" name="OutPath" value="bin" />
- <property category="sys" name="SourcePath" value="src;../ajde/src;../compiler/src;../util/src" />
- <property category="sys" name="Title" value="" />
- <property category="sys" name="Version" value="1.0" />
- <property category="sys" name="WorkingDirectory" value="." />
- <property category="sys" name="uidesign.size.org.aspectj.tools.ajbrowser.TopFrame" value="612,471" />
- <node type="Package" name="org.aspectj.tools.ajbrowser" />
-</project>
-
diff --git a/ajbrowser/pom.xml b/ajbrowser/pom.xml deleted file mode 100644 index 4df5cf765..000000000 --- a/ajbrowser/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ -<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.9-SNAPSHOT</version> - </parent> - - <artifactId>ajbrowser</artifactId> - - <dependencies> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>util</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>bridge</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>asm</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>ajde.core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>org.aspectj.ajdt.core</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project> diff --git a/ajbrowser/src/.cvsignore b/ajbrowser/src/.cvsignore deleted file mode 100644 index cf9a8cca3..000000000 --- a/ajbrowser/src/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -ajbrowser.lst -ajbrowserSrc.lst diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java deleted file mode 100644 index e140d3bd9..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/BrowserManager.java +++ /dev/null @@ -1,227 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * Helen Hawkins Converted to new interface (bug 148190) - * ******************************************************************/ -package org.aspectj.tools.ajbrowser; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.JFrame; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.IconRegistry; -import org.aspectj.ajde.internal.BuildConfigManager; -import org.aspectj.ajde.ui.FileStructureView; -import org.aspectj.ajde.ui.InvalidResourceException; -import org.aspectj.ajde.ui.UserPreferencesAdapter; -import org.aspectj.ajde.ui.internal.UserPreferencesStore; -import org.aspectj.ajde.ui.javaoptions.JavaBuildOptions; -import org.aspectj.ajde.ui.javaoptions.JavaCompilerWarningsOptionsPanel; -import org.aspectj.ajde.ui.javaoptions.JavaComplianceOptionsPanel; -import org.aspectj.ajde.ui.javaoptions.JavaDebugOptionsPanel; -import org.aspectj.ajde.ui.javaoptions.JavaOtherOptionsPanel; -import org.aspectj.ajde.ui.swing.MultiStructureViewPanel; -import org.aspectj.asm.IHierarchy; -import org.aspectj.asm.IHierarchyListener; -import org.aspectj.tools.ajbrowser.core.BrowserBuildProgressMonitor; -import org.aspectj.tools.ajbrowser.core.BrowserCompilerConfiguration; -import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler; -import org.aspectj.tools.ajbrowser.ui.BasicEditor; -import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler; -import org.aspectj.tools.ajbrowser.ui.BrowserRuntimeProperties; -import org.aspectj.tools.ajbrowser.ui.BrowserUIAdapter; -import org.aspectj.tools.ajbrowser.ui.EditorManager; -import org.aspectj.tools.ajbrowser.ui.swing.BrowserOptionsPanel; -import org.aspectj.tools.ajbrowser.ui.swing.MessageHandlerPanel; -import org.aspectj.tools.ajbrowser.ui.swing.TopFrame; -import org.aspectj.util.FileUtil; - -/** - * IDE manager for standalone AJDE application. - * - * @author Mik Kersten - */ -public class BrowserManager { - - public static final String TITLE = "AspectJ Browser"; - - private static final BrowserManager INSTANCE = new BrowserManager(); - private EditorManager editorManager; - private UserPreferencesAdapter preferencesAdapter; - private static TopFrame topFrame = null; - - private List<String> configFiles = new ArrayList<>(); - private JavaBuildOptions javaBuildOptions; - - public static BrowserManager getDefault() { - return INSTANCE; - } - - public final IHierarchyListener VIEW_LISTENER = new IHierarchyListener() { - public void elementsUpdated(IHierarchy model) { - FileStructureView fsv = Ajde.getDefault().getStructureViewManager().getDefaultFileView(); - if (fsv != null) { - fsv.setSourceFile(BrowserManager.getDefault().getEditorManager().getCurrFile()); - } - } - }; - - public void init(String[] configFilesArgs, boolean visible) { - try { - javaBuildOptions = new JavaBuildOptions(); - preferencesAdapter = new UserPreferencesStore(true); - topFrame = new TopFrame(); - - BasicEditor ajdeEditor = new BasicEditor(); - editorManager = new EditorManager(ajdeEditor); - - BrowserMessageHandler messageHandler = new BrowserMessageHandler(); - - Ajde.getDefault().init(new BrowserCompilerConfiguration(preferencesAdapter), messageHandler, - new BrowserBuildProgressMonitor(messageHandler), ajdeEditor, new BrowserUIAdapter(), new IconRegistry(), - topFrame, new BrowserRuntimeProperties(preferencesAdapter), true); - - setUpTopFrame(visible); - addOptionsPanels(); - - setUpConfigFiles(configFilesArgs); - - Ajde.getDefault().getModel().addListener(VIEW_LISTENER); - - } catch (Throwable t) { - t.printStackTrace(); - BrowserErrorHandler.handleError("AJDE failed to initialize.", t); - } - } - - /** - * Find and create the set of build configuration files - * - * @param configFilesArgs - */ - private void setUpConfigFiles(String[] configFilesArgs) { - configFiles = getConfigFilesList(configFilesArgs); - if (configFiles.size() == 0) { - BrowserErrorHandler.handleWarning("No build configuration selected. " - + "Select a \".lst\" build configuration file in order to compile and navigate structure."); - } else { - Ajde.getDefault().getBuildConfigManager().setActiveConfigFile((String) configFiles.get(0)); - } - } - - /** - * Create the top frame of the browser - */ - private void setUpTopFrame(boolean visible) { - MultiStructureViewPanel multiViewPanel = new MultiStructureViewPanel(Ajde.getDefault().getViewManager().getBrowserPanel(), - Ajde.getDefault().getFileStructurePanel()); - - topFrame.init(multiViewPanel, new MessageHandlerPanel(), editorManager.getEditorPanel()); - - if (visible) - topFrame.setVisible(true); - } - - public void resetEditorFrame() { - topFrame.resetSourceEditorPanel(); - } - - public void resetEditor() { - BrowserManager - .getDefault() - .getRootFrame() - .setSize(BrowserManager.getDefault().getRootFrame().getWidth() + 1, - BrowserManager.getDefault().getRootFrame().getHeight() + 1); - BrowserManager.getDefault().getRootFrame().doLayout(); - BrowserManager.getDefault().getRootFrame().repaint(); - } - - public void setStatusInformation(String text) { - topFrame.statusText_label.setText(text); - } - - public void setEditorStatusText(String text) { - topFrame.setTitle(BrowserManager.TITLE + " - " + text); - } - - public void saveAll() { - editorManager.saveContents(); - } - - public JFrame getRootFrame() { - return topFrame; - } - - public void openFile(String filePath) { - try { - if (filePath.endsWith(".lst")) { - Ajde.getDefault().getBuildConfigEditor().openFile(filePath); - topFrame.setEditorPanel(Ajde.getDefault().getBuildConfigEditor()); - } else if (FileUtil.hasSourceSuffix(filePath)) { - editorManager.showSourceLine(filePath, 0, false); - } else { - BrowserErrorHandler.handleError("File: " + filePath - + " could not be opened because the extension was not recoginzed."); - } - } catch (IOException ioe) { - BrowserErrorHandler.handleError("Could not open file: " + filePath, ioe); - } catch (InvalidResourceException ire) { - BrowserErrorHandler.handleError("Invalid file: " + filePath, ire); - } - } - - private List<String> getConfigFilesList(String[] configFiles) { - List<String> configs = new ArrayList<>(); - for (String configFile : configFiles) { - if (configFile.endsWith(BuildConfigManager.CONFIG_FILE_SUFFIX)) { - configs.add(configFile); - } - } - return configs; - } - - /** - * Add the different options panels to the main options frame (adds panels for java compliance, compiler warnings, debug - * warnings, other java options and options specific to ajbrowser) - */ - private void addOptionsPanels() { - Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaComplianceOptionsPanel(javaBuildOptions)); - Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaCompilerWarningsOptionsPanel(javaBuildOptions)); - Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaOtherOptionsPanel(javaBuildOptions)); - Ajde.getDefault().getOptionsFrame().addOptionsPanel(new JavaDebugOptionsPanel(javaBuildOptions)); - Ajde.getDefault().getOptionsFrame().addOptionsPanel(new BrowserOptionsPanel()); - } - - /** - * @return the EditorManager - */ - public EditorManager getEditorManager() { - return editorManager; - } - - /** - * @return the UserPreferencesAdapter - */ - public UserPreferencesAdapter getPreferencesAdapter() { - return preferencesAdapter; - } - - /** - * @return the JavaBuildOptions instance being used - */ - public JavaBuildOptions getJavaBuildOptions() { - return javaBuildOptions; - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java deleted file mode 100644 index 51a33c73e..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/Main.java +++ /dev/null @@ -1,72 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - -package org.aspectj.tools.ajbrowser; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Run ajbrowser if 0+ .lst file arguments, and ajc otherwise. - */ -public class Main { - - /** - * Run ajbrowser if args contains only .lst files and ajc otherwise. - * - * @param args the String[] of args to interpret - */ - public static void main(String[] args) { - if (!compilerMain(args)) { - BrowserManager.getDefault().init(args, true); - } - } - - /** - * Invoke the compiler if there are arguments and some are not .lst files. - * - * @return false if compiler was not invoked and the browser main should be - */ - static boolean compilerMain(String[] args) { - if ((null == args) || (0 == args.length)) { - return false; - } - int numConfigFiles = 0; - for (String arg : args) { - if ((null != arg) && arg.endsWith(".lst")) { - numConfigFiles++; - } - } - if (numConfigFiles != args.length) { - try { - Class<?> ajc = Class.forName("org.aspectj.tools.ajc.Main"); - Method main = ajc.getMethod("main", new Class[] { String[].class }); - main.invoke(null, new Object[] { args }); - return true; - } catch (ClassNotFoundException e) { - report(e); - } catch (NoSuchMethodException e) { - report(e); - } catch (IllegalAccessException e) { - report(e); - } catch (InvocationTargetException e) { - report(e.getTargetException()); - } - } - return false; - } - - private static void report(Throwable t) { - t.printStackTrace(System.err); - } -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserBuildProgressMonitor.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserBuildProgressMonitor.java deleted file mode 100644 index a19c2b717..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserBuildProgressMonitor.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.core; - -import javax.swing.JDialog; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.core.IBuildProgressMonitor; -import org.aspectj.ajde.ui.swing.BuildProgressPanel; -import org.aspectj.tools.ajbrowser.BrowserManager; -import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler; -import org.aspectj.tools.ajbrowser.ui.swing.TopFrame; - -/** - * Build progress monitor that shows the progress in a dialog containing - * a JProgressBar. Also updates the progress bar at the bottom of AjBrowser - * with the build progress information. - */ -public class BrowserBuildProgressMonitor extends Thread implements IBuildProgressMonitor { - - public static final String PROGRESS_HEADING = "AspectJ Build"; - - private BuildProgressPanel progressDialog = null; - private JDialog dialog = null; - private TopFrame topFrame; - - private BrowserMessageHandler handler; - - public BrowserBuildProgressMonitor(BrowserMessageHandler handler) { - this.handler = handler; - topFrame = (TopFrame) BrowserManager.getDefault().getRootFrame(); - dialog = new JDialog(topFrame, PROGRESS_HEADING, false); - progressDialog = new BuildProgressPanel(); - dialog.setContentPane(progressDialog); - dialog.setSize(550, 120); - try { - dialog.setLocationRelativeTo(topFrame); - } catch (NoSuchMethodError nsme) { - // running on 1.3 - } - } - - public void finish(boolean wasFullBuild) { - Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("build finished..."); - progressDialog.finish(); - dialog.dispose(); - if (handler.getMessages().isEmpty()) { - topFrame.hideMessagesPanel(handler); - } else { - topFrame.showMessagesPanel(handler); - } - } - - public boolean isCancelRequested() { - boolean isCancel = progressDialog.isCancelRequested(); - if (isCancel) { - Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("Compile aborted"); - } - return isCancel; - } - - public void setProgress(double percentDone) { - progressDialog.setProgressBarVal((int) (percentDone*progressDialog.getProgressBarMax())); - } - - public void setProgressText(String text) { - Ajde.getDefault().getIdeUIAdapter().displayStatusInformation(text); - progressDialog.setProgressText(text); - } - - public void begin() { - Ajde.getDefault().getIdeUIAdapter().displayStatusInformation("starting build..."); - handler.reset(); - progressDialog.setProgressBarVal(0); - progressDialog.setProgressText("starting build..."); - dialog.setLocationRelativeTo(Ajde.getDefault().getRootFrame()); - dialog.setVisible(true); - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java deleted file mode 100644 index 24999b7b4..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserCompilerConfiguration.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.core; - -import java.io.File; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.aspectj.ajde.core.ICompilerConfiguration; -import org.aspectj.ajde.core.IOutputLocationManager; -import org.aspectj.ajde.ui.UserPreferencesAdapter; -import org.aspectj.tools.ajbrowser.BrowserManager; - -/** - * AjBrowser implementation of ICompilerConfiguration which returns something for getClasspath(), getJavaOptionsMap(), - * getNonStandardOptions() and getOutputLocationManager() and null for everything else. The reason it doesn't return anything for - * getProjectSourceFiles() is that it uses .lst files to record what is needed to build (via BuildConfigManager). - */ -public class BrowserCompilerConfiguration implements ICompilerConfiguration { - - private UserPreferencesAdapter preferencesAdapter; - private IOutputLocationManager locationManager; - - public BrowserCompilerConfiguration(UserPreferencesAdapter preferencesAdapter) { - this.preferencesAdapter = preferencesAdapter; - } - - public String getClasspath() { - StringBuilder classpath = new StringBuilder(); - String userPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH); - if (userPath != null && userPath.trim().length() != 0) { - classpath.append(userPath); - } - List<File> outputDirs = getOutputLocationManager().getAllOutputLocations(); - for (File dir : outputDirs) { - classpath.append(File.pathSeparator + dir.getAbsolutePath() + File.pathSeparator); - } - classpath.append(System.getProperty("java.class.path", ".")); - // System.out.println("classpath: " + classpath.toString()); - return classpath.toString(); - } - - public Map<String,String> getJavaOptionsMap() { - return BrowserManager.getDefault().getJavaBuildOptions().getJavaBuildOptionsMap(); - } - - public String getNonStandardOptions() { - return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS); - } - - public IOutputLocationManager getOutputLocationManager() { - if (locationManager == null) { - locationManager = new BrowserOutputLocationManager(preferencesAdapter); - } - return locationManager; - } - - public List<String> getProjectSourceFiles() { - // unimplemented in AjBrowser (uses BuildConfigManager instead) - return null; - } - - public List getProjectSourceFilesChanged() { - // unimplemented in AjBrowser (uses BuildConfigManager instead) - return null; - } - - public Map getSourcePathResources() { - // unimplemented in AjBrowser - return null; - } - - public Set<File> getAspectPath() { - // unimplemented in AjBrowser - return null; - } - - public Set<File> getInpath() { - // unimplemented in AjBrowser - return null; - } - - public String getOutJar() { - // unimplemented in AjBrowser - return null; - } - - public int getConfigurationChanges() { - return ICompilerConfiguration.EVERYTHING; - } - - public void configurationRead() { - } - - public List getClasspathElementsWithModifiedContents() { - return null; - } - - public List<String> getProjectXmlConfigFiles() { - return Collections.emptyList(); - } - - public String getProjectEncoding() { - return null; - } - - public String getProcessor() { - return null; - } - - public String getProcessorPath() { - return null; - } - - @Override - public String getModulepath() { - return null; - } - - @Override - public String getModuleSourcepath() { - return null; - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserErrorHandler.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserErrorHandler.java deleted file mode 100644 index d264e1900..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserErrorHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.core; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.swing.JOptionPane; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.swing.ErrorDialog; -import org.aspectj.tools.ajbrowser.BrowserManager; - -/** - * Error handler used by AjBrowser. Handles errors and warnings by - * producing an error/warning dialog. - */ -public class BrowserErrorHandler { - - public static void handleWarning(String message) { - JOptionPane.showMessageDialog(BrowserManager.getDefault() - .getRootFrame(), message, "AJBrowser Warning", - JOptionPane.WARNING_MESSAGE); - } - - public static void handleError(String errorMessage) { - handleError(errorMessage, null); - } - - public static void handleError(String message, Throwable t) { - String stack = getStackTraceAsString(t); - ErrorDialog errorDialog = new ErrorDialog(Ajde.getDefault() - .getRootFrame(), "AJBrowser Error", t, message, stack); - errorDialog.setVisible(true); - } - - private static String getStackTraceAsString(Throwable t) { - StringWriter stringWriter = new StringWriter(); - if (t != null) { - t.printStackTrace(new PrintWriter(stringWriter)); - return stringWriter.getBuffer().toString(); - } - return "<no stack trace available>"; - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserOutputLocationManager.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserOutputLocationManager.java deleted file mode 100644 index 81192131d..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/BrowserOutputLocationManager.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.core; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.aspectj.ajde.core.IOutputLocationManager; -import org.aspectj.ajde.ui.UserPreferencesAdapter; - -/** - * IOutputLocationManager which returns the same output location for all files and resources. - */ -public class BrowserOutputLocationManager implements IOutputLocationManager { - - private UserPreferencesAdapter preferencesAdapter; - - public BrowserOutputLocationManager(UserPreferencesAdapter preferencesAdapter) { - this.preferencesAdapter = preferencesAdapter; - } - - public File getOutputLocationForClass(File compilationUnit) { - return new File(getCommonOutputDir()); - } - - public File getOutputLocationForResource(File resource) { - return new File(getCommonOutputDir()); - } - - private String getCommonOutputDir() { - String outputPath = preferencesAdapter.getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH); - if (outputPath == null) { - return "."; - } - return outputPath; - } - - public List<File> getAllOutputLocations() { - List<File> outputDirs = new ArrayList<>(); - outputDirs.add(new File(getCommonOutputDir())); - return outputDirs; - } - - public File getDefaultOutputLocation() { - return new File(getCommonOutputDir()); - } - - public String getSourceFolderForFile(File sourceFile) { - return null; - } - - public void reportFileWrite(String outputfile, int filetype) { - } - - public void reportFileRemove(String outputfile, int filetype) { - } - - public int discoverChangesSince(File dir, long buildtime) { - return 0; - } - - public Map<File, String> getInpathMap() { - return Collections.emptyMap(); - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/PreferenceStoreConstants.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/PreferenceStoreConstants.java deleted file mode 100644 index f92fae4c1..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/core/PreferenceStoreConstants.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.core; - -/** - * Constants used by the preference store - */ -public class PreferenceStoreConstants { - - public static final String BUILD_CLASSPATH = "build.classpath"; - public static final String RUNTIME_MAINCLASS = "runtime.mainClass"; - public static final String BUILD_OUTPUTPATH = "build.outputpath"; - public static final String JAVA_CLASSPATH = "java.class.path"; - public static final String NONSTANDARD_OPTIONS = "ajc.nonStandardOptions"; - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BasicEditor.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BasicEditor.java deleted file mode 100644 index 438b3c20f..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BasicEditor.java +++ /dev/null @@ -1,187 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * Helen Hawkins Converted to new interface (bug 148190) - * ******************************************************************/ - - -package org.aspectj.tools.ajbrowser.ui; - -import java.awt.BorderLayout; -import java.awt.Font; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; - -import javax.swing.JEditorPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.text.BadLocationException; -import javax.swing.text.DefaultHighlighter; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.EditorAdapter; -import org.aspectj.bridge.ISourceLocation; -import org.aspectj.tools.ajbrowser.BrowserManager; -import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler; - -/** - * Bare-bones editor implementation used when the framework is being used - * standalone. - * - * @author Mik Kersten - */ -public class BasicEditor implements EditorAdapter { - - private String NO_FILE = "<no file selected>"; - private String filePath = NO_FILE; - private JPanel editor_panel = new JPanel(); - - // @todo get rid of these - private int currHighlightStart = 0; - private int currHighlightEnd = 0; - - private BorderLayout borderLayout1 = new BorderLayout(); - private JScrollPane jScrollPane1 = new JScrollPane(); - private JEditorPane editorPane = new JEditorPane(); - - public BasicEditor() { - try { - editorPane.setEditable(true); - editorPane.setContentType("text/plain"); - editorPane.setFont(new Font("Monospaced", 0, 11)); - editor_panel.add(editorPane); - jbInit(); - } - catch(Exception e) { - BrowserErrorHandler.handleError("Could not initialize GUI.", e); - } - } - - public String getCurrFile() { - return filePath; - } - - public void showSourceLine(ISourceLocation sourceLocation, boolean highlight) { - try { - showSourceLine(sourceLocation.getSourceFile().getAbsolutePath(), sourceLocation.getLine(), highlight); - } catch (NullPointerException npe) { - Ajde.getDefault().getIdeUIAdapter().displayStatusInformation(" no corresponding source line to seek to"); - } - } - - public void showSourceLine(int lineNumber, boolean highlight) { - showSourceLine(filePath, lineNumber, highlight); - } - - public void pasteToCaretPos(String text) { - if (currHighlightEnd < 1) return; - String contents = editorPane.getText(); - String pasted = contents.substring(0, currHighlightEnd) + - text + contents.substring(currHighlightEnd, contents.length()); - editorPane.setText(pasted); - } - - public void showSourceLine(String filePath, int lineNumber, boolean highlight) { - //AjdeUIManager.getDefault().getIdeUIAdapter().resetEditor(); - - this.filePath = filePath; -// if (oldPath != filePath && !Ajde.INSTANCE.BROWSER_MANAGER.isGlobalMode()) { -// Ajde.INSTANCE.BROWSER_MANAGER.updateView(); -// } - -// Ajde.IDE_MANAGER.setEditorStatusText(filePath); - - currHighlightStart = 0; - currHighlightEnd = 0; - editorPane.setText(readFile(filePath, lineNumber)); - try { - editorPane.getHighlighter().addHighlight(currHighlightStart, currHighlightEnd, DefaultHighlighter.DefaultPainter); - editorPane.setCaretPosition(currHighlightStart); - } catch (BadLocationException ble) { - BrowserErrorHandler.handleError("Could not highlight location.", ble); - } - BrowserManager.getDefault().getEditorManager().notifyCurrentFileChanged(filePath); - } - - /** - * Not implemented. - */ - public void showSourcelineAnnotation(String filePath, int lineNumber, java.util.List items) { } - - public void addEditorViewForSourceLine(String filePath, int lineNumber) { - - } - - public void saveContents() throws IOException { - if (!filePath.equals(NO_FILE) && !filePath.equals("") && !editorPane.getText().equals("")) { - BufferedWriter writer = new BufferedWriter(new FileWriter(filePath)); - writer.write(editorPane.getText()); - writer.close(); - } - } - - public JPanel getPanel() { - return editor_panel; - } - - public void showSourceForFile(String filePath) { } - - public void showSourceForLine(int lineNumber, boolean highlight) { } - - public void showSourceForSourceLine(String filePath, int lineNumber, boolean highlight) { } - - public String getCurrSourceFilePath() { return null; } - - public void setBreakpointRequest(String filePath, int lineNumber, boolean isDeferred) { } - - public void clearBreakpointRequest(String filePath, int lineNumber) { } - - private String readFile(String filePath, int lineNumber) { - try { -// URL url = ClassLoader.getSystemResource(filePath); - File file = new File(filePath); - if (!file.exists()) { - return "ERROR: file \"" + filePath + "\" does not exist."; - } - BufferedReader reader = new BufferedReader(new FileReader(file)); - StringBuilder contents = new StringBuilder(); - String line = reader.readLine(); - int numLines = 0; - while (line != null) { - numLines++; - if (numLines < lineNumber) { - currHighlightStart += line.length()+1; - } - if (numLines == lineNumber) { - currHighlightEnd = currHighlightStart + line.length(); - } - contents.append(line); - contents.append('\n'); - line = reader.readLine(); - } - reader.close(); - return contents.toString(); - } catch (IOException ioe) { - return "ERROR: could not read file \"" + filePath + "\", make sure that you have mounted /project/aop on X:\\"; - } - } - - private void jbInit() throws Exception { - editor_panel.setFont(new java.awt.Font("DialogInput", 1, 12)); - editor_panel.setLayout(borderLayout1); - editor_panel.add(jScrollPane1, BorderLayout.CENTER); - jScrollPane1.getViewport().add(editorPane, null); - } -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java deleted file mode 100644 index 2878e84a3..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserMessageHandler.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.ui; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.IUIBuildMessageHandler; -import org.aspectj.ajde.ui.swing.ErrorDialog; -import org.aspectj.bridge.AbortException; -import org.aspectj.bridge.IMessage; -import org.aspectj.bridge.IMessage.Kind; - -/** - * MessageHandler used by AjBrowser that displays ERROR messages with exceptions and ABORT messages in an error dialog. Other - * messages are displayed by the MessageHandlerPanel. By default INFO and WEAVEINFO messages are ignored. - */ -public class BrowserMessageHandler implements IUIBuildMessageHandler { - - private List<IMessage.Kind> ignoring; - private List<IMessage> messages; - - public BrowserMessageHandler() { - ignoring = new ArrayList<>(); - messages = new ArrayList<>(); - ignore(IMessage.INFO); - ignore(IMessage.WEAVEINFO); - } - - public boolean handleMessage(IMessage message) throws AbortException { - Kind messageKind = message.getKind(); - if (isIgnoring(messageKind)) { - return true; - } - if (messageKind.equals(IMessage.ABORT) || (message.getThrown() != null)) { - String stack = getStackTraceAsString(message.getThrown()); - ErrorDialog errorDialog = new ErrorDialog(Ajde.getDefault().getRootFrame(), "AJDE Error", message.getThrown(), - message.getMessage(), stack); - errorDialog.setVisible(true); - return true; - } - messages.add(message); - return true; - } - - public void dontIgnore(Kind kind) { - if (null != kind) { - ignoring.remove(kind); - } - } - - public boolean isIgnoring(Kind kind) { - return ((null != kind) && (ignoring.contains(kind))); - } - - public void ignore(Kind kind) { - if ((null != kind) && (!ignoring.contains(kind))) { - ignoring.add(kind); - } - } - - public List<IMessage> getMessages() { - return messages; - } - - private String getStackTraceAsString(Throwable t) { - StringWriter stringWriter = new StringWriter(); - if (t != null) { - t.printStackTrace(new PrintWriter(stringWriter)); - return stringWriter.getBuffer().toString(); - } - return "<no stack trace available>"; - } - - public void reset() { - messages.clear(); - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserRuntimeProperties.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserRuntimeProperties.java deleted file mode 100644 index a680da984..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserRuntimeProperties.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.ui; - -import org.aspectj.ajde.IRuntimeProperties; -import org.aspectj.ajde.ui.UserPreferencesAdapter; -import org.aspectj.tools.ajbrowser.core.PreferenceStoreConstants; - -/** - * AjBrowser implementation of IRuntimeProperties which uses the PreferenceStoreConstant - * to decide which class the user has specified contains the main method - */ -public class BrowserRuntimeProperties implements IRuntimeProperties { - - private UserPreferencesAdapter preferencesAdapter; - - public BrowserRuntimeProperties(UserPreferencesAdapter preferencesAdapter) { - this.preferencesAdapter = preferencesAdapter; - } - - public String getClassToExecute() { - return preferencesAdapter.getProjectPreference(PreferenceStoreConstants.RUNTIME_MAINCLASS); - } - - public String getExecutionArgs() { - // not implemented by ajbrowser - return null; - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserUIAdapter.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserUIAdapter.java deleted file mode 100644 index a6a993d91..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/BrowserUIAdapter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - - -package org.aspectj.tools.ajbrowser.ui; - -import org.aspectj.ajde.IdeUIAdapter; -import org.aspectj.tools.ajbrowser.BrowserManager; - -/** - * AjBrowser implementation if IdeUIAdapter which displays the provided - * information in the status bar at the bottom of the AjBrowser GUI. - */ -public class BrowserUIAdapter implements IdeUIAdapter { - - public void displayStatusInformation(String message) { - BrowserManager.getDefault().setStatusInformation(message); - } -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/EditorManager.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/EditorManager.java deleted file mode 100644 index f004e6e2b..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/EditorManager.java +++ /dev/null @@ -1,167 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - -package org.aspectj.tools.ajbrowser.ui; - -import java.awt.BorderLayout; -import java.awt.event.KeyEvent; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - -import javax.swing.Box; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; - -import org.aspectj.ajde.EditorAdapter; -import org.aspectj.ajde.EditorListener; -import org.aspectj.bridge.ISourceLocation; -import org.aspectj.tools.ajbrowser.core.BrowserErrorHandler; - -/** - * Responsible for controlling the editor. - * - * <p><b>TODO:</b> remove coupling to <CODE>BasicEditor</CODE></p> - * @author Mik Kersten - */ -public class EditorManager { - - /** @return true if input modifiers have shift down */ - public static boolean isShiftDown(int modifiers) { - return (0 != (modifiers & KeyEvent.SHIFT_MASK)); - } - - private EditorAdapter editor = null; - private BasicEditor basicEditor = null; - private List<EditorListener> editorListeners = new ArrayList<>(); - private Vector<EditorAdapter> editors = new Vector<>(); - private JPanel editor_panel = null; - private Box editors_box = Box.createVerticalBox(); - - public EditorManager(EditorAdapter ajdeEditor) { - if (ajdeEditor instanceof BasicEditor) { - this.basicEditor = (BasicEditor) ajdeEditor; - editors.add(basicEditor); - editors_box.add(basicEditor.getPanel()); - editor_panel = new JPanel(new BorderLayout()); - editor_panel.add(editors_box, BorderLayout.CENTER); - } else { - editors.add(ajdeEditor); - this.editor = ajdeEditor; - } - } - - public void addListener(EditorListener editorListener) { - editorListeners.add(editorListener); - } - - public void removeListener(EditorListener editorListener) { - editorListeners.remove(editorListener); - } - - public void notifyCurrentFileChanged(String filePath) { - for (EditorListener editorListener : editorListeners) { - editorListener.currentFileChanged(filePath); - } - } - - public void addViewForSourceLine(final String filePath, final int lineNumber) { - if (basicEditor == null) - return; - editors_box.remove(basicEditor.getPanel()); - final BasicEditor newEditor = new BasicEditor(); - editors.add(newEditor); - - Runnable update = new Runnable() { - public void run() { - editors_box.add(newEditor.getPanel()); - newEditor.showSourceLine(filePath, lineNumber, true); - // AjdeUIManager.getDefault().getIdeUIAdapter().resetGUI(); - } - }; - - if (SwingUtilities.isEventDispatchThread()) { - update.run(); - } else { - try { - SwingUtilities.invokeAndWait(update); - } catch (Exception e) { - BrowserErrorHandler.handleError("Could not add view for source line.", e); - } - } - } - - public String getCurrFile() { - if (basicEditor != null) { - return basicEditor.getCurrFile(); - } else { - return editor.getCurrFile(); - } - } - - public void showSourceLine(ISourceLocation sourceLocation, boolean highlight) { - if (sourceLocation != null) { - showSourceLine(sourceLocation.getSourceFile().getAbsolutePath(), sourceLocation.getLine(), highlight); - } - } - - /** - * <b>TODO</b>: remove "instanceof AjdeManager" hack - */ - public void showSourceLine(String filePath, int lineNumber, boolean highlight) { - if (editors.size() > 1) { - editors_box.removeAll(); - editors_box.add(basicEditor.getPanel()); - // AjdeUIManager.getDefault().getIdeUIAdapter().resetGUI(); - editors.removeAllElements(); - editors.add(basicEditor); - } - - if (basicEditor != null) { - basicEditor.showSourceLine(filePath, lineNumber, highlight); - } else { - editor.showSourceLine(filePath, lineNumber, highlight); - } - } - - public void pasteToCaretPos(String text) { - if (basicEditor != null) { - basicEditor.pasteToCaretPos(text); - } else { - editor.pasteToCaretPos(text); - } - } - - public void showSourcelineAnnotation(String filePath, int lineNumber, java.util.List items) { - editor.showSourcelineAnnotation(filePath, lineNumber, items); - } - - public void saveContents() { - try { - for (EditorAdapter editorAdapter : editors) { - editorAdapter.saveContents(); - } - } catch (IOException ioe) { - BrowserErrorHandler.handleError("Editor could not save the current file.", ioe); - } - } - - public JPanel getEditorPanel() { - if (editor_panel != null) { - return editor_panel; - } else { - return basicEditor.getPanel(); - } - } -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/BrowserOptionsPanel.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/BrowserOptionsPanel.java deleted file mode 100644 index fd93bb51f..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/BrowserOptionsPanel.java +++ /dev/null @@ -1,159 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * Helen Hawkins Converted to new interface (bug 148190) - * ******************************************************************/ - - -package org.aspectj.tools.ajbrowser.ui.swing; - -import java.io.*; -import javax.swing.*; -import java.awt.*; -import javax.swing.border.*; -import org.aspectj.ajde.ui.swing.*; -import org.aspectj.tools.ajbrowser.BrowserManager; -import org.aspectj.tools.ajbrowser.core.PreferenceStoreConstants; - -/** - * Panel the displays both ajc and runtime options - * - * @author Mik Kersten - */ -public class BrowserOptionsPanel extends OptionsPanel { - - private static final long serialVersionUID = 4491319302490183151L; - private JPanel runOptions_panel = new JPanel(); - private JPanel build_panel = new JPanel(); - private FlowLayout flowLayout1 = new FlowLayout(); - private JTextField classToRun_field = new JTextField(); - private JLabel jLabel4 = new JLabel(); - private BorderLayout borderLayout4 = new BorderLayout(); - private JPanel buildPaths_panel = new JPanel(); - private Box compileOptions_box2 = Box.createVerticalBox(); - private JTextField classpath_field = new JTextField(); - private JTextField outputPath_field = new JTextField(); - private JTextField nonStandardOptions_field = new JTextField(); - private JLabel jLabel16 = new JLabel(); - private JLabel jLabel15 = new JLabel(); - private JLabel nonStandardOptions_label = new JLabel(); - private Box compileOptions_box3 = Box.createVerticalBox(); - private BorderLayout borderLayout1 = new BorderLayout(); - private Border border1; - private TitledBorder titledBorder1; - private Border border2; - private Border border3; - private TitledBorder titledBorder2; - private Border border4; - - public BrowserOptionsPanel() { - try { - jbInit(); - this.setName("AJBrowser Options"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void loadOptions() throws IOException { - outputPath_field.setText( - BrowserManager.getDefault().getPreferencesAdapter(). - getProjectPreference(PreferenceStoreConstants.BUILD_OUTPUTPATH) - ); - nonStandardOptions_field.setText( - BrowserManager.getDefault().getPreferencesAdapter(). - getProjectPreference(PreferenceStoreConstants.NONSTANDARD_OPTIONS) - ); - classpath_field.setText( - BrowserManager.getDefault().getPreferencesAdapter(). - getProjectPreference(PreferenceStoreConstants.BUILD_CLASSPATH) - ); - classToRun_field.setText( - BrowserManager.getDefault().getPreferencesAdapter(). - getProjectPreference(PreferenceStoreConstants.RUNTIME_MAINCLASS) - ); - } - - public void saveOptions() throws IOException { - BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference( - PreferenceStoreConstants.BUILD_OUTPUTPATH, outputPath_field.getText()); - BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference( - PreferenceStoreConstants.NONSTANDARD_OPTIONS, nonStandardOptions_field.getText()); - BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference( - PreferenceStoreConstants.BUILD_CLASSPATH, classpath_field.getText()); - BrowserManager.getDefault().getPreferencesAdapter().setProjectPreference( - PreferenceStoreConstants.RUNTIME_MAINCLASS, classToRun_field.getText()); - } - - private void jbInit() throws Exception { - border1 = - BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)); - titledBorder1 = new TitledBorder(border1, "Ajc Options"); - border2 = - BorderFactory.createCompoundBorder( - titledBorder1, - BorderFactory.createEmptyBorder(5, 5, 5, 5)); - border3 = - BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158)); - titledBorder2 = new TitledBorder(border3, "Run Options"); - border4 = - BorderFactory.createCompoundBorder( - titledBorder2, - BorderFactory.createEmptyBorder(5, 5, 5, 5)); - this.setLayout(borderLayout1); - build_panel.setLayout(borderLayout4); - classToRun_field.setFont(new java.awt.Font("SansSerif", 0, 11)); - classToRun_field.setMinimumSize(new Dimension(200, 21)); - classToRun_field.setPreferredSize(new Dimension(250, 21)); - jLabel4.setFont(new java.awt.Font("Dialog", 0, 11)); - jLabel4.setText("Fully qualified name for main class to run: "); - buildPaths_panel.setLayout(flowLayout1); - runOptions_panel.setBorder(border4); - buildPaths_panel.setBorder(border2); - classpath_field.setFont(new java.awt.Font("SansSerif", 0, 11)); - classpath_field.setMinimumSize(new Dimension(100, 21)); - classpath_field.setPreferredSize(new Dimension(150, 21)); - outputPath_field.setPreferredSize(new Dimension(225, 21)); - outputPath_field.setMinimumSize(new Dimension(100, 21)); - outputPath_field.setFont(new java.awt.Font("SansSerif", 0, 11)); - nonStandardOptions_field.setPreferredSize(new Dimension(225, 21)); - nonStandardOptions_field.setMinimumSize(new Dimension(100, 21)); - nonStandardOptions_field.setFont(new java.awt.Font("SansSerif", 0, 11)); - jLabel16.setText("Classpath (defaults to current directory): "); - jLabel16.setPreferredSize(new Dimension(200, 25)); - jLabel16.setMaximumSize(new Dimension(400, 25)); - jLabel16.setFont(new java.awt.Font("Dialog", 0, 11)); - jLabel15.setMaximumSize(new Dimension(400, 25)); - jLabel15.setFont(new java.awt.Font("Dialog", 0, 11)); - jLabel15.setPreferredSize(new Dimension(230, 25)); - jLabel15.setText("Output path (defaults to current directory): "); - nonStandardOptions_label.setMaximumSize(new Dimension(400, 25)); - nonStandardOptions_label.setFont(new java.awt.Font("Dialog", 0, 11)); - nonStandardOptions_label.setPreferredSize(new Dimension(230, 25)); - nonStandardOptions_label.setText("Non-standard compiler options: "); - titledBorder1.setTitleFont(new java.awt.Font("Dialog", 0, 11)); - titledBorder2.setTitleFont(new java.awt.Font("Dialog", 0, 11)); - runOptions_panel.add(jLabel4, null); - runOptions_panel.add(classToRun_field, null); - build_panel.add(buildPaths_panel, BorderLayout.CENTER); - build_panel.add(runOptions_panel, BorderLayout.SOUTH); - compileOptions_box2.add(outputPath_field, null); - compileOptions_box2.add(nonStandardOptions_field, null); - compileOptions_box2.add(classpath_field, null); - compileOptions_box3.add(jLabel15, null); - compileOptions_box3.add(nonStandardOptions_label, null); - compileOptions_box3.add(jLabel16, null); - buildPaths_panel.add(compileOptions_box3, null); - buildPaths_panel.add(compileOptions_box2, null); - this.add(build_panel, BorderLayout.NORTH); - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java deleted file mode 100644 index 7c02f6426..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/MessageHandlerPanel.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************** - * Copyright (c) 2007 Contributors. All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: IBM Corporation - initial API and implementation - * Helen Hawkins - initial version (bug 148190) - *******************************************************************/ -package org.aspectj.tools.ajbrowser.ui.swing; - -import java.awt.BorderLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.util.List; - -import javax.swing.DefaultListModel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.swing.CompilerMessagesCellRenderer; -import org.aspectj.bridge.IMessage; -import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler; - -/** - * Panel used to display messages from the message handler - */ -public class MessageHandlerPanel extends JPanel { - - private static final long serialVersionUID = -2251912345065588977L; - private JScrollPane jScrollPane1 = new JScrollPane(); - private JList list; - private DefaultListModel listModel; - private BorderLayout borderLayout1 = new BorderLayout(); - - public void showMessageHandlerPanel(BrowserMessageHandler handler, boolean showPanel) { - if (!showPanel) { - setVisible(false); - return; - } - createList(handler.getMessages()); - - try { - jbInit(); - } catch (Exception e) { - e.printStackTrace(); - } - list.setModel(listModel); - - MouseListener mouseListener = new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - if (e.getClickCount() >= 1) { - int index = list.locationToIndex(e.getPoint()); - if (listModel.getSize() >= index && index != -1) { - IMessage message = (IMessage) listModel - .getElementAt(index); - Ajde.getDefault().getEditorAdapter().showSourceLine( - message.getSourceLocation(), true); - } - } - } - }; - list.addMouseListener(mouseListener); - list.setCellRenderer(new CompilerMessagesCellRenderer()); - setVisible(showPanel); - } - - private void createList(List<IMessage> messages) { - list = new JList(); - listModel = new DefaultListModel(); - for (IMessage message : messages) { - listModel.addElement(message); - } - } - - private void jbInit() throws Exception { - this.setLayout(borderLayout1); - this.add(jScrollPane1, BorderLayout.CENTER); - jScrollPane1.getViewport().add(list, null); - } - -} diff --git a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/TopFrame.java b/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/TopFrame.java deleted file mode 100644 index 5d9b7cc17..000000000 --- a/ajbrowser/src/main/java/org/aspectj/tools/ajbrowser/ui/swing/TopFrame.java +++ /dev/null @@ -1,599 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - -package org.aspectj.tools.ajbrowser.ui.swing; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.KeyEvent; -import java.awt.event.WindowEvent; -import java.io.File; - -import javax.swing.AbstractAction; -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JPopupMenu; -import javax.swing.JSplitPane; -import javax.swing.JToolBar; -import javax.swing.KeyStroke; -import javax.swing.border.Border; -import javax.swing.filechooser.FileFilter; - -import org.aspectj.ajde.Ajde; -import org.aspectj.ajde.ui.swing.AJButtonMenuCombo; -import org.aspectj.ajde.ui.swing.BuildConfigPopupMenu; -import org.aspectj.ajde.ui.swing.MultiStructureViewPanel; -import org.aspectj.asm.IProgramElement; -import org.aspectj.tools.ajbrowser.BrowserManager; -import org.aspectj.tools.ajbrowser.ui.BrowserMessageHandler; -import org.aspectj.tools.ajbrowser.ui.EditorManager; - -/** - * UI for standalone operation. - * - * @author Mik Kersten - */ -public class TopFrame extends JFrame { - - private static final long serialVersionUID = 1007473581156451702L; - - private static final File CURRENT_DIR = new File("."); - - public JLabel statusText_label = new JLabel(); - - private JPanel editor_panel = null; - private JPanel sourceEditor_panel = null; - - private JMenuBar menuBar = new JMenuBar(); - private JMenu jMenu1 = new JMenu(); - private JMenu jMenu2 = new JMenu(); - private JMenuItem projectBuild_menuItem = new JMenuItem(); - private FlowLayout left_flowLayout = new FlowLayout(); - private JMenuItem jMenuItem1 = new JMenuItem(); - private JMenuItem exit_menuItem = new JMenuItem(); - private JSplitPane top_splitPane = new JSplitPane(); - private BorderLayout borderLayout3 = new BorderLayout(); - private JMenuItem projectRun_menuItem = new JMenuItem(); - private JMenuItem projectRunOther_menuItem = new JMenuItem(); - private JPanel status_panel = new JPanel(); - private BorderLayout borderLayout4 = new BorderLayout(); - private Border emptyBorder = BorderFactory.createEmptyBorder(); - private JPanel toolbar_panel = new JPanel(); - private JSplitPane right_splitPane = new JSplitPane(); - private MessageHandlerPanel messages_panel = null; - private JMenu tools_menu = new JMenu(); - private JMenuItem joinpointProbe_menuItem = new JMenuItem(); - private JMenuItem projectDebug_menuItem = new JMenuItem(); - private JMenuItem svProperties_menuItem = new JMenuItem(); - private File lastChosenDir = CURRENT_DIR; - - JPanel toolBar_panel = new JPanel(); - JToolBar build_toolBar = new JToolBar(); - JButton closeConfig_button = new JButton(); - JButton openConfig_button = new JButton(); - JButton run_button = new JButton(); - JToolBar project_toolBar = new JToolBar(); - JButton save_button = new JButton(); - JButton options_button = new JButton(); - JButton editConfig_button = new JButton(); - JToolBar file_toolBar = new JToolBar(); - JPanel filler_panel = new JPanel(); - BorderLayout borderLayout5 = new BorderLayout(); - BorderLayout borderLayout6 = new BorderLayout(); - Border border8; - JLabel jLabel1 = new JLabel(); - JLabel jLabel2 = new JLabel(); - JPanel multiView_panel; - - private AJButtonMenuCombo buildCombo; - - public void init(MultiStructureViewPanel multiViewPanel, - MessageHandlerPanel compilerMessagesPanel, JPanel editorPanel) { - try { - this.multiView_panel = multiViewPanel; - this.messages_panel = compilerMessagesPanel; - this.editor_panel = editorPanel; - this.sourceEditor_panel = editorPanel; - - jbInit(); - svProperties_menuItem.setIcon(Ajde.getDefault() - .getIconRegistry().getBrowserOptionsIcon()); - projectBuild_menuItem.setIcon(Ajde.getDefault() - .getIconRegistry().getBuildIcon()); - projectRun_menuItem.setIcon(Ajde.getDefault() - .getIconRegistry().getExecuteIcon()); - projectRunOther_menuItem.setIcon(Ajde.getDefault() - .getIconRegistry().getExecuteIcon()); - projectDebug_menuItem.setIcon(Ajde.getDefault() - .getIconRegistry().getDebugIcon()); - - this.setJMenuBar(menuBar); - this.setIconImage(((ImageIcon) Ajde.getDefault() - .getIconRegistry().getStructureSwingIcon( - IProgramElement.Kind.ADVICE)).getImage()); - this.setLocation(75, 10); - this.setSize(900, 650); - this.setTitle(BrowserManager.TITLE); - // bindKeys(); - fixButtonBorders(); - messages_panel.setVisible(false); - - JPopupMenu orderMenu = new BuildConfigPopupMenu( - new AbstractAction() { - - private static final long serialVersionUID = 1L; - - public void actionPerformed(ActionEvent arg0) { - BrowserManager.getDefault().saveAll(); - } - }); - - buildCombo = new AJButtonMenuCombo("Build", "Build", Ajde - .getDefault().getIconRegistry().getBuildIcon(), orderMenu, - false); - - build_toolBar.add(buildCombo, 1); - refreshBuildMenu(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void refreshBuildMenu() { - JPopupMenu orderMenu = new BuildConfigPopupMenu(new AbstractAction() { - private static final long serialVersionUID = -3204840278758386318L; - - public void actionPerformed(ActionEvent arg0) { - BrowserManager.getDefault().saveAll(); - } - }); - - buildCombo.setMenu(orderMenu); - } - - public void setEditorPanel(JPanel panel) { - editor_panel = panel; - right_splitPane.remove(editor_panel); - right_splitPane.add(panel, JSplitPane.TOP); - panel.setVisible(true); - } - - /** - * @todo get rid of this method and make jbinit() work properly - */ - private void fixButtonBorders() { - run_button.setBorder(null); - options_button.setBorder(null); - openConfig_button.setBorder(null); - closeConfig_button.setBorder(null); - save_button.setBorder(null); - editConfig_button.setBorder(null); - } - - private void jbInit() throws Exception { - border8 = BorderFactory.createCompoundBorder(BorderFactory - .createEtchedBorder(Color.white, new Color(156, 156, 158)), - BorderFactory.createEmptyBorder(2, 2, 2, 2)); - emptyBorder = BorderFactory.createEmptyBorder(2, 2, 2, 2); - jMenu1.setFont(new java.awt.Font("Dialog", 0, 11)); - jMenu1.setText("File"); - jMenu1.setMnemonic(KeyEvent.VK_F); - jMenu2.setFont(new java.awt.Font("Dialog", 0, 11)); - jMenu2.setText("Project"); - jMenu2.setMnemonic(KeyEvent.VK_P); - projectBuild_menuItem.setFont(new java.awt.Font("Dialog", 0, 11)); - projectBuild_menuItem.setText("Build"); - projectBuild_menuItem.setMnemonic(KeyEvent.VK_B); - projectBuild_menuItem.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_B, ActionEvent.ALT_MASK)); - - projectBuild_menuItem - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - projectBuild_menuItem_actionPerformed(e); - } - }); - left_flowLayout.setAlignment(FlowLayout.LEFT); - jMenuItem1.setFont(new java.awt.Font("Dialog", 0, 11)); - jMenuItem1.setText("Save"); - jMenuItem1.setMnemonic(KeyEvent.VK_S); - jMenuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, - ActionEvent.ALT_MASK)); - jMenuItem1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - jMenuItem1_actionPerformed(e); - } - }); - exit_menuItem.setFont(new java.awt.Font("Dialog", 0, 11)); - exit_menuItem.setText("Exit"); - exit_menuItem.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - exit_menuItem_actionPerformed(e); - } - }); - top_splitPane.setPreferredSize(new Dimension(706, 800)); - top_splitPane.setDividerSize(4); - this.getContentPane().setLayout(borderLayout3); - projectRun_menuItem.setEnabled(true); - projectRun_menuItem.setFont(new java.awt.Font("Dialog", 0, 11)); - projectRun_menuItem.setText("Run in same VM"); - projectRun_menuItem - .setToolTipText("Run in same VM (hold shift down to run in separate process)"); - projectRun_menuItem.setMnemonic(KeyEvent.VK_R); - projectRun_menuItem.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_R, ActionEvent.ALT_MASK)); - projectRun_menuItem - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - projectRun_menuItem_actionPerformed(e); - } - }); - projectRunOther_menuItem.setEnabled(true); - projectRunOther_menuItem.setFont(new java.awt.Font("Dialog", 0, 11)); - projectRunOther_menuItem.setText("Run in separate process"); - projectRunOther_menuItem.setMnemonic(KeyEvent.VK_P); - projectRunOther_menuItem.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_P, ActionEvent.ALT_MASK)); - projectRunOther_menuItem - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - projectRunOther_menuItem_actionPerformed(e); - } - }); - statusText_label.setFont(new java.awt.Font("Dialog", 0, 11)); - statusText_label.setBorder(BorderFactory.createLoweredBevelBorder()); - statusText_label.setMaximumSize(new Dimension(2000, 20)); - statusText_label.setPreferredSize(new Dimension(300, 20)); - status_panel.setLayout(borderLayout4); - this.addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosed(WindowEvent e) { - this_windowClosed(e); - } - - public void windowClosing(WindowEvent e) { - this_windowClosing(e); - } - }); - toolbar_panel.setLayout(borderLayout5); - right_splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); - right_splitPane.setBorder(null); - right_splitPane.setDividerSize(4); - tools_menu.setFont(new java.awt.Font("Dialog", 0, 11)); - tools_menu.setText("Tools"); - tools_menu.setMnemonic(KeyEvent.VK_T); - projectDebug_menuItem.setEnabled(false); - projectDebug_menuItem.setFont(new java.awt.Font("Dialog", 0, 11)); - projectDebug_menuItem.setText("Debug"); - svProperties_menuItem - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - svProperties_menuItem_actionPerformed(e); - } - }); - svProperties_menuItem.setText("Options..."); - svProperties_menuItem.setActionCommand("AJDE Console..."); - svProperties_menuItem.setFont(new java.awt.Font("Dialog", 0, 11)); - svProperties_menuItem.setMnemonic(KeyEvent.VK_O); - svProperties_menuItem.setAccelerator(KeyStroke.getKeyStroke( - KeyEvent.VK_O, ActionEvent.ALT_MASK)); - build_toolBar.setBorder(emptyBorder); - build_toolBar.setFloatable(false); - closeConfig_button.setMaximumSize(new Dimension(100, 20)); - closeConfig_button.setEnabled(true); - closeConfig_button.setFont(new java.awt.Font("Dialog", 0, 11)); - closeConfig_button.setBorder(null); - closeConfig_button.setMinimumSize(new Dimension(24, 20)); - closeConfig_button.setPreferredSize(new Dimension(20, 20)); - closeConfig_button.setToolTipText("Close build configuration"); - closeConfig_button.setIcon(Ajde.getDefault().getIconRegistry() - .getCloseConfigIcon()); - closeConfig_button - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - closeConfig_button_actionPerformed(e); - } - }); - openConfig_button.setMaximumSize(new Dimension(100, 20)); - openConfig_button.setEnabled(true); - openConfig_button.setFont(new java.awt.Font("Dialog", 0, 11)); - openConfig_button.setBorder(null); - openConfig_button.setMinimumSize(new Dimension(24, 20)); - openConfig_button.setPreferredSize(new Dimension(20, 20)); - openConfig_button.setToolTipText("Select build configuration..."); - openConfig_button.setIcon(Ajde.getDefault().getIconRegistry() - .getOpenConfigIcon()); - openConfig_button - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - openConfig_button_actionPerformed(e); - } - }); - run_button.setMaximumSize(new Dimension(60, 20)); - run_button.setEnabled(true); - run_button.setFont(new java.awt.Font("Dialog", 0, 11)); - run_button.setBorder(null); - run_button.setMinimumSize(new Dimension(24, 20)); - run_button.setPreferredSize(new Dimension(20, 20)); - run_button - .setToolTipText("Run in same VM (hold shift down to run in separate process)"); - run_button.setIcon(Ajde.getDefault().getIconRegistry() - .getExecuteIcon()); - run_button.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - run_button_actionPerformed(e); - } - }); - project_toolBar.setBorder(emptyBorder); - save_button.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - save_button_actionPerformed(e); - } - }); - save_button.setIcon(Ajde.getDefault().getIconRegistry() - .getSaveIcon()); - save_button.setText("Save"); - save_button.setToolTipText("Save"); - save_button.setPreferredSize(new Dimension(55, 20)); - save_button.setMinimumSize(new Dimension(24, 20)); - save_button.setFont(new java.awt.Font("Dialog", 0, 11)); - save_button.setBorder(null); - save_button.setMaximumSize(new Dimension(60, 20)); - options_button.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - options_button_actionPerformed(e); - } - }); - options_button.setIcon(Ajde.getDefault().getIconRegistry() - .getBrowserOptionsIcon()); - options_button.setText("Options"); - options_button.setToolTipText("Options..."); - options_button.setPreferredSize(new Dimension(60, 20)); - options_button.setMinimumSize(new Dimension(24, 20)); - options_button.setFont(new java.awt.Font("Dialog", 0, 11)); - options_button.setBorder(null); - options_button.setMaximumSize(new Dimension(80, 20)); - editConfig_button - .addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(ActionEvent e) { - editConfig_button_actionPerformed(e); - } - }); - editConfig_button.setIcon(Ajde.getDefault().getIconRegistry() - .getStructureSwingIcon(IProgramElement.Kind.FILE_LST)); - editConfig_button.setText("Edit Config"); - editConfig_button.setToolTipText("Edit Config..."); - editConfig_button.setPreferredSize(new Dimension(80, 20)); - editConfig_button.setMinimumSize(new Dimension(24, 20)); - editConfig_button.setFont(new java.awt.Font("Dialog", 0, 11)); - editConfig_button.setBorder(null); - editConfig_button.setMaximumSize(new Dimension(80, 20)); - file_toolBar.setBorder(emptyBorder); - toolBar_panel.setLayout(borderLayout6); - jLabel1.setFont(new java.awt.Font("Dialog", 0, 11)); - jLabel1.setText(" Build: "); - jLabel2.setText(" Run: "); - jLabel2.setFont(new java.awt.Font("Dialog", 0, 11)); - // fileStructure_panel.setFont(new java.awt.Font("Dialog", 0, 11)); - // browser_panel.setFont(new java.awt.Font("Dialog", 0, 11)); - this.getContentPane().add(top_splitPane, BorderLayout.CENTER); - top_splitPane.add(right_splitPane, JSplitPane.RIGHT); - top_splitPane.add(multiView_panel, JSplitPane.LEFT); - right_splitPane.add(messages_panel, JSplitPane.BOTTOM); - right_splitPane.add(editor_panel, JSplitPane.TOP); - // structureView_pane.add(fileStructure_panel, JSplitPane.RIGHT); - // structureView_pane.add(browser_panel, JSplitPane.LEFT); - this.getContentPane().add(status_panel, BorderLayout.SOUTH); - status_panel.add(statusText_label, BorderLayout.CENTER); - this.getContentPane().add(toolbar_panel, BorderLayout.NORTH); - toolbar_panel.add(filler_panel, BorderLayout.CENTER); - toolbar_panel.add(toolBar_panel, BorderLayout.WEST); - // file_toolBar.add(editConfig_button, null); - file_toolBar.add(save_button, null); - file_toolBar.add(options_button, null); - toolBar_panel.add(build_toolBar, BorderLayout.WEST); - toolBar_panel.add(project_toolBar, BorderLayout.CENTER); - project_toolBar.add(jLabel2, null); - project_toolBar.add(run_button, null); - build_toolBar.add(jLabel1, null); - build_toolBar.add(openConfig_button, null); - build_toolBar.add(closeConfig_button, null); - toolBar_panel.add(file_toolBar, BorderLayout.EAST); - menuBar.add(jMenu1); - menuBar.add(jMenu2); - menuBar.add(tools_menu); - jMenu1.add(jMenuItem1); - jMenu1.addSeparator(); - jMenu1.add(exit_menuItem); - jMenu2.add(projectBuild_menuItem); - jMenu2.add(projectRun_menuItem); - jMenu2.add(projectRunOther_menuItem); - // jMenu2.add(projectDebug_menuItem); - tools_menu.add(joinpointProbe_menuItem); - tools_menu.add(svProperties_menuItem); - top_splitPane.setDividerLocation(380); - right_splitPane.setDividerLocation(500); - project_toolBar.addSeparator(); - project_toolBar.addSeparator(); - } - - private void exit_menuItem_actionPerformed(ActionEvent e) { - quit(); - } - - private void this_windowClosing(WindowEvent e) { - quit(); - } - - private void quit() { - this.dispose(); - System.exit(0); - } - - void treeMode_comboBox_actionPerformed(ActionEvent e) { - } - - void save_button_actionPerformed(ActionEvent e) { - BrowserManager.getDefault().getEditorManager().saveContents(); - } - - void this_windowClosed(WindowEvent e) { - quit(); - } - - public void showMessagesPanel(BrowserMessageHandler handler) { - right_splitPane.setDividerLocation(right_splitPane.getHeight() - 100); - messages_panel.showMessageHandlerPanel(handler, true); - } - - public void hideMessagesPanel(BrowserMessageHandler handler) { - right_splitPane.setDividerLocation(right_splitPane.getHeight()); - messages_panel.showMessageHandlerPanel(handler, false); - } - - void jMenuItem1_actionPerformed(ActionEvent e) { - BrowserManager.getDefault().getEditorManager().saveContents(); - } - - void projectBuild_menuItem_actionPerformed(ActionEvent e) { - BrowserManager.getDefault().saveAll(); - if (EditorManager.isShiftDown(e.getModifiers())) { - buildFresh(); - } else { - build(); - } - } - - void run_button_actionPerformed(ActionEvent e) { - if (EditorManager.isShiftDown(e.getModifiers())) { - runInNewVM(); - } else { - runInSameVM(); - } - } - - void projectRunOther_menuItem_actionPerformed(ActionEvent e) { - runInNewVM(); - } - - void projectRun_menuItem_actionPerformed(ActionEvent e) { - if (EditorManager.isShiftDown(e.getModifiers())) { - runInNewVM(); - } else { - runInSameVM(); - } - } - - void build_button_actionPerformed(ActionEvent e) { - BrowserManager.getDefault().saveAll(); - if (EditorManager.isShiftDown(e.getModifiers())) { - buildFresh(); - } else { - build(); - } - } - - void options_button_actionPerformed(ActionEvent e) { - Ajde.getDefault().showOptionsFrame(); - } - - void editConfig_button_actionPerformed(ActionEvent e) { - BrowserManager.getDefault().openFile( - Ajde.getDefault().getBuildConfigManager() - .getActiveConfigFile()); - refreshBuildMenu(); - } - - public void resetSourceEditorPanel() { - right_splitPane.removeAll(); - right_splitPane.add(sourceEditor_panel, JSplitPane.TOP); - } - - private void svProperties_menuItem_actionPerformed(ActionEvent e) { - Ajde.getDefault().showOptionsFrame(); - } - - private void openConfig_button_actionPerformed(ActionEvent e) { - JFileChooser fileChooser = new JFileChooser(); - fileChooser.setCurrentDirectory(lastChosenDir); - fileChooser.setFileFilter(new FileFilter() { - public boolean accept(File f) { - return (f.getPath().endsWith(".lst") || f.isDirectory()); - } - - public String getDescription() { - return "AspectJ Build Configuration (*.lst)"; - } - }); - int returnVal = fileChooser.showOpenDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - File result = fileChooser.getSelectedFile(); - String path = result.getAbsolutePath();// .replace('\\', '/'); - if (!Ajde.getDefault().getBuildConfigManager() - .getAllBuildConfigFiles().contains(path)) { - Ajde.getDefault().getBuildConfigManager() - .getAllBuildConfigFiles().add(0, path); - } - Ajde.getDefault().getBuildConfigManager().setActiveConfigFile( - path); - lastChosenDir = result.getParentFile(); - if (null == lastChosenDir) { - lastChosenDir = CURRENT_DIR; - } - refreshBuildMenu(); - } - } - - private void closeConfig_button_actionPerformed(ActionEvent e) { - Ajde.getDefault().getBuildConfigManager() - .getAllBuildConfigFiles().remove( - Ajde.getDefault().getBuildConfigManager() - .getActiveConfigFile()); - if (!Ajde.getDefault().getBuildConfigManager() - .getAllBuildConfigFiles().isEmpty()) { - Ajde.getDefault().getBuildConfigManager().setActiveConfigFile( - (String) Ajde.getDefault().getBuildConfigManager() - .getAllBuildConfigFiles().get(0)); - } - refreshBuildMenu(); - } - - private void buildFresh() { - Ajde.getDefault().runBuildInDifferentThread(Ajde.getDefault() - .getBuildConfigManager().getActiveConfigFile(), true); - } - - private void build() { - Ajde.getDefault().runBuildInDifferentThread(Ajde.getDefault() - .getBuildConfigManager().getActiveConfigFile(), false); - } - - private void runInSameVM() { - Ajde.getDefault().runInSameVM(); - } - - private void runInNewVM() { - Ajde.getDefault().runInNewVM(); - } - -} diff --git a/ajbrowser/src/test/java/org/aspectj/tools/ajbrowser/JemmyDriver.java b/ajbrowser/src/test/java/org/aspectj/tools/ajbrowser/JemmyDriver.java deleted file mode 100644 index 48bc0aabe..000000000 --- a/ajbrowser/src/test/java/org/aspectj/tools/ajbrowser/JemmyDriver.java +++ /dev/null @@ -1,80 +0,0 @@ -/* ******************************************************************* - * Copyright (c) 1999-2001 Xerox Corporation, - * 2002 Palo Alto Research Center, Incorporated (PARC). - * All rights reserved. - * This program and the accompanying materials are made available - * under the terms of the Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * Contributors: - * Xerox/PARC initial implementation - * ******************************************************************/ - - -package org.aspectj.tools.ajbrowser; -// -//import org.netbeans.jemmy.Test; -//import org.netbeans.jemmy.Scenario; -//import org.netbeans.jemmy.ClassReference; -//import org.netbeans.jemmy.operators.JFrameOperator; -//import org.netbeans.jemmy.operators.JButtonOperator; -// -///** -// * Programmatically drives AJBrowser gui, -// * currently to do a build. -// */ -//public class JemmyDriver implements Scenario { -// -// public static final String CUT -// = "org.aspectj.tools.ajbrowser.Main"; -// public static final String DRIVER -// = "org.aspectj.tools.ajbrowser.JemmyDriver"; -// -// // XXX need to fix literal path locations -// public static final String USERDIR -// = "j:/home/wes/dev/tools/aj/examples"; -// public static final String FILENAME_RELATIVE -// = USERDIR + "spacewar/debug.lst"; -// public static final String FILENAME -// = USERDIR + "/" + FILENAME_RELATIVE; -// -// public static void main(String[] argv) { -// // 0 is (this) class name -// // 1 is the location of the work directory -// // others are parameters -// String[] params = {DRIVER, USERDIR, FILENAME}; -// Test.main(params); -// } -// -// public int runIt(Object param) { -// try { -// String[] args = new String[]{}; -// // grab parameter - pass in .lst file -// if (null != param) { -// Class c = param.getClass(); -// if (c.isArray() && -// (String.class == c.getComponentType())) { -// args = (String[]) param; -// if (0 < args.length) { -// if (FILENAME.equals(args[0])) { -// System.out.println("got file..."); -// } -// } -// } -// } -// // start application with our .lst file -// new ClassReference(CUT).startApplication(args); -// // wait frame -// JFrameOperator mainFrame = new JFrameOperator("AspectJ Browser"); -// // do a build - hangs if no list file -// new JButtonOperator(mainFrame, "Build").push(); -// -// } catch(Exception e) { -// e.printStackTrace(); -// return(1); -// } -// return(0); -// } -// -//} diff --git a/ajbrowser/testdata/.cvsignore b/ajbrowser/testdata/.cvsignore deleted file mode 100644 index ba077a403..000000000 --- a/ajbrowser/testdata/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin diff --git a/ajde.core/pom.xml b/ajde.core/pom.xml index 9d2bdde5d..eefb3a411 100644 --- a/ajde.core/pom.xml +++ b/ajde.core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>ajde.core</artifactId> diff --git a/ajde/pom.xml b/ajde/pom.xml index 4991c9f36..51679ae2d 100644 --- a/ajde/pom.xml +++ b/ajde/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>ajde</artifactId> diff --git a/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java b/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java index b36378b22..a866a0c96 100644 --- a/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java +++ b/ajde/src/main/java/org/aspectj/ajde/IconRegistry.java @@ -39,9 +39,6 @@ public class IconRegistry extends AbstractIconRegistry { private final Icon BUILD = makeIcon("actions/build.gif"); private final Icon DEBUG = makeIcon("actions/debug.gif"); private final Icon EXECUTE = makeIcon("actions/execute.gif"); - private final Icon AJBROWSER = makeIcon("structure/advice.gif"); - private final Icon AJBROWSER_ENABLED = makeIcon("actions/browserEnabled.gif"); - private final Icon AJBROWSER_DISABLED = makeIcon("actions/browserDisabled.gif"); private final Icon STRUCTURE_VIEW = makeIcon("actions/structureView.gif"); private final Icon HIDE_ASSOCIATIONS = makeIcon("actions/hideAssociations.gif"); @@ -85,9 +82,6 @@ public class IconRegistry extends AbstractIconRegistry { public Icon getErrorIcon() { return ERROR; } public Icon getWarningIcon() { return WARNING; } public Icon getInfoIcon() { return INFO; } - public Icon getAJBrowserIcon() { return AJBROWSER; } - public Icon getAJBrowserEnabledIcon() { return AJBROWSER_ENABLED; } - public Icon getAJBrowserDisabledIcon() { return AJBROWSER_DISABLED; } public Icon getPopupIcon() { return POPUP; } public Icon getFilterIcon() { return FILTER; } public Icon getOrderIcon() { return ORDER; } diff --git a/ajdoc/pom.xml b/ajdoc/pom.xml index 0218e17f0..50922a65c 100644 --- a/ajdoc/pom.xml +++ b/ajdoc/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>ajdoc</artifactId> diff --git a/asm/pom.xml b/asm/pom.xml index d2a24d706..ff1bdc1ed 100644 --- a/asm/pom.xml +++ b/asm/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>asm</artifactId> diff --git a/aspectjmatcher/pom.xml b/aspectjmatcher/pom.xml index b34180220..f707b22e6 100644 --- a/aspectjmatcher/pom.xml +++ b/aspectjmatcher/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>aspectjmatcher</artifactId> diff --git a/aspectjrt/pom.xml b/aspectjrt/pom.xml index f9614eaef..22a47dd29 100644 --- a/aspectjrt/pom.xml +++ b/aspectjrt/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>aspectjrt</artifactId> diff --git a/aspectjtools/aspectjtools-assembly.xml b/aspectjtools/aspectjtools-assembly.xml index 004e1048e..fefc2c8d8 100644 --- a/aspectjtools/aspectjtools-assembly.xml +++ b/aspectjtools/aspectjtools-assembly.xml @@ -85,13 +85,6 @@ <!-- tools --> <fileSet> - <directory>../ajbrowser/target/classes</directory> - <outputDirectory>.</outputDirectory> - <excludes> - <exclude>META-INF/maven/**</exclude> - </excludes> - </fileSet> - <fileSet> <directory>../ajde/target/classes</directory> <outputDirectory>.</outputDirectory> <excludes> @@ -129,4 +122,3 @@ </fileSets> </assembly> - diff --git a/aspectjtools/aspectjtools-sources-assembly.xml b/aspectjtools/aspectjtools-sources-assembly.xml index 8317c9f20..cc708ae7f 100644 --- a/aspectjtools/aspectjtools-sources-assembly.xml +++ b/aspectjtools/aspectjtools-sources-assembly.xml @@ -48,10 +48,6 @@ <!-- Tools --> <fileSet> - <directory>../ajbrowser/src/main/java</directory> - <outputDirectory>.</outputDirectory> - </fileSet> - <fileSet> <directory>../ajde/src/main/java</directory> <outputDirectory>.</outputDirectory> </fileSet> @@ -81,4 +77,3 @@ </fileSets> </assembly> - diff --git a/aspectjtools/pom.xml b/aspectjtools/pom.xml index 2533e145a..3c6f708d3 100644 --- a/aspectjtools/pom.xml +++ b/aspectjtools/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>aspectjtools</artifactId> @@ -406,11 +406,6 @@ </dependency> <dependency> <groupId>org.aspectj</groupId> - <artifactId>ajbrowser</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.aspectj</groupId> <artifactId>ajde</artifactId> <version>${project.version}</version> </dependency> diff --git a/aspectjweaver/pom.xml b/aspectjweaver/pom.xml index 668b72985..a173b769c 100644 --- a/aspectjweaver/pom.xml +++ b/aspectjweaver/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>aspectjweaver</artifactId> diff --git a/bcel-builder/pom.xml b/bcel-builder/pom.xml index 0f14ab58f..f2f8ca305 100644 --- a/bcel-builder/pom.xml +++ b/bcel-builder/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>bcel-builder</artifactId> diff --git a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java index 1ce3682d3..3c1c12daf 100644 --- a/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java +++ b/bcel-builder/src/main/java/org/aspectj/apache/bcel/Constants.java @@ -98,8 +98,10 @@ public interface Constants { short MINOR_16 = 0; short MAJOR_17 = 61; short MINOR_17 = 0; -// short MAJOR_18 = 62; -// short MINOR_18 = 0; + short MAJOR_18 = 62; + short MINOR_18 = 0; +// short MAJOR_19 = 63; +// short MINOR_19 = 0; int PREVIEW_MINOR_VERSION = 65535; diff --git a/bridge/pom.xml b/bridge/pom.xml index 893c1040e..20411313c 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>bridge</artifactId> diff --git a/build/build-properties.xml b/build/build-properties.xml index c735b855b..febfddfec 100644 --- a/build/build-properties.xml +++ b/build/build-properties.xml @@ -109,7 +109,7 @@ <property file="${aspectj.modules.build.dir}/junit-patterns.properties"/> <property name="aspectj.tools.modules.13" - value="ajbrowser,ajde,ajde.core,ajdoc,asm,bridge,loadtime,org.aspectj.ajdt.core,runtime,taskdefs,util,weaver"/> + value="ajde,ajde.core,ajdoc,asm,bridge,loadtime,org.aspectj.ajdt.core,runtime,taskdefs,util,weaver"/> <property name="aspectj.tools.modules.15" value="loadtime5,aspectj5rt,weaver5"/> <condition property="aspectj.tools.modules" diff --git a/build/build.xml b/build/build.xml index f5a6eef8f..a5f33476a 100644 --- a/build/build.xml +++ b/build/build.xml @@ -474,10 +474,6 @@ To use testing client jar in tests, </antcall> </target> - <target name="ajbrowser-all" > - <build-module-all module="ajbrowser"/> - </target> - <target name="ajdoc-all"> <build-module-all module="ajdoc"/> </target> diff --git a/build/pom.xml b/build/pom.xml index 87b72257a..23ae6dd97 100644 --- a/build/pom.xml +++ b/build/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>build</artifactId> diff --git a/build/products/aspectj/install/finish.html b/build/products/aspectj/install/finish.html index 204deb550..229f3a21a 100644 --- a/build/products/aspectj/install/finish.html +++ b/build/products/aspectj/install/finish.html @@ -6,17 +6,17 @@ <body> -<p>The automatic installation process is complete. +<p>The automatic installation process is complete. We recommend you complete the installation as follows:</p> <ol> - <li>Add <b><code>${installer.output.aspectjrt}</code></b> + <li>Add <b><code>${installer.output.aspectjrt}</code></b> to your CLASSPATH. - This small .jar file contains classes required by any + This small .jar file contains classes required by any program compiled with the ajc compiler. </li> - <li>Modify your PATH to include + <li>Modify your PATH to include <code> <b>${installer.output.dir.bin}</b></code>. - This will make it easier to run ajc and ajbrowser. + This will make it easier to run ajc. </li> </ol> diff --git a/build/src/main/java/$installer$/org/aspectj/Main.java b/build/src/main/java/$installer$/org/aspectj/Main.java index e4c649094..fa98b8ed0 100644 --- a/build/src/main/java/$installer$/org/aspectj/Main.java +++ b/build/src/main/java/$installer$/org/aspectj/Main.java @@ -1331,8 +1331,6 @@ class InstallPane extends WizardPane { LaunchScriptMaker lsm = new LaunchScriptMaker(context); lsm.writeScript("ajc"); lsm.writeScript("ajdoc"); - //lsm.writeScript("ajdb"); - lsm.writeScript("ajbrowser"); // Moved to the bin dir in 1.2.1 // we should now come back and make the generation of this diff --git a/build/src/main/resources/$installer$/org/aspectj/resources/finish.html b/build/src/main/resources/$installer$/org/aspectj/resources/finish.html index 204deb550..229f3a21a 100644 --- a/build/src/main/resources/$installer$/org/aspectj/resources/finish.html +++ b/build/src/main/resources/$installer$/org/aspectj/resources/finish.html @@ -6,17 +6,17 @@ <body> -<p>The automatic installation process is complete. +<p>The automatic installation process is complete. We recommend you complete the installation as follows:</p> <ol> - <li>Add <b><code>${installer.output.aspectjrt}</code></b> + <li>Add <b><code>${installer.output.aspectjrt}</code></b> to your CLASSPATH. - This small .jar file contains classes required by any + This small .jar file contains classes required by any program compiled with the ajc compiler. </li> - <li>Modify your PATH to include + <li>Modify your PATH to include <code> <b>${installer.output.dir.bin}</b></code>. - This will make it easier to run ajc and ajbrowser. + This will make it easier to run ajc. </li> </ol> diff --git a/build/src/test/java/org/aspectj/build/BuildModuleTests.java b/build/src/test/java/org/aspectj/build/BuildModuleTests.java index 181d84fcc..b95ed8fa9 100644 --- a/build/src/test/java/org/aspectj/build/BuildModuleTests.java +++ b/build/src/test/java/org/aspectj/build/BuildModuleTests.java @@ -86,9 +86,6 @@ public class BuildModuleTests extends TestCase { fail("" + UnknownFileCheck.STATIC_ERRORS); } } - public void testLicense_ajbrowser() { - checkLicense("ajbrowser"); - } public void testLicense_ajde() { checkLicense("ajde"); } @@ -308,4 +305,3 @@ public class BuildModuleTests extends TestCase { } } - diff --git a/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java b/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java index b8a6c6d15..21994404a 100644 --- a/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java +++ b/build/src/test/java/org/aspectj/internal/build/BuildModuleTest.java @@ -58,7 +58,7 @@ public class BuildModuleTest extends TestCase { private static final String[] SKIPS //= {}; = {"aspectjtools", "ajdoc", "aspectj5rt", "run-all-junit-tests", - "ajbrowser", "testing", "testing-drivers", "org.aspectj.ajdt.core", "weaver"}; + "testing", "testing-drivers", "org.aspectj.ajdt.core", "weaver"}; private static final String SKIP_MESSAGE = "BuildModuleTest: Define \"run.build.tests\" as a system " @@ -184,11 +184,6 @@ public class BuildModuleTest extends TestCase { fail(dupError); } } - public void testAjbrowser() { - checkBuild("ajbrowser", - "org.aspectj.tools.ajbrowser.Main", - new String[] {"-noExit", "-version"}); // compiler version - } public void testTestingUtils() { checkBuild("testing-util"); } diff --git a/build/src/test/java/org/aspectj/internal/build/ModulesTest.java b/build/src/test/java/org/aspectj/internal/build/ModulesTest.java index 5b1692570..49de9fe1c 100644 --- a/build/src/test/java/org/aspectj/internal/build/ModulesTest.java +++ b/build/src/test/java/org/aspectj/internal/build/ModulesTest.java @@ -44,7 +44,7 @@ public class ModulesTest extends TestCase { static { String[] names = { - "ajbrowser", "ajde", "ajdoc", "asm", + "ajde", "ajdoc", "asm", "bridge", "loadtime", "org.aspectj.ajdt.core", "runtime", "taskdefs", "testing-client", "testing-util", "tests", "util", "weaver"}; diff --git a/docs/devGuideDB/ajbrowser-building.gif b/docs/devGuideDB/ajbrowser-building.gif Binary files differdeleted file mode 100644 index 29767c605..000000000 --- a/docs/devGuideDB/ajbrowser-building.gif +++ /dev/null diff --git a/docs/devGuideDB/ajbrowser-options.gif b/docs/devGuideDB/ajbrowser-options.gif Binary files differdeleted file mode 100644 index 41ba67654..000000000 --- a/docs/devGuideDB/ajbrowser-options.gif +++ /dev/null diff --git a/docs/devGuideDB/ajbrowser.xml b/docs/devGuideDB/ajbrowser.xml deleted file mode 100644 index 6a6c85c25..000000000 --- a/docs/devGuideDB/ajbrowser.xml +++ /dev/null @@ -1,421 +0,0 @@ -<chapter id="ajbrowser" xreflabel="AspectJ Browser"> - - <title>AspectJ Browser</title> - - <sect1 id="ajbrowser-intro"> - <title>Introduction</title> - <para> - AJBrowser presents a GUI for compiling programs with ajc - and navigating crosscutting structure. - </para> - <para> - The AspectJ Browser can edit program source files, - compile using the AspectJ compiler <literal>ajc</literal> - run a program, - and graphically navigate the program's - crosscutting structure. - For more information on <literal>ajc</literal>, - see <xref linkend="ajc-ref"/>. - - - </para> - - <para> - Launch the browser from the command line either - by typing "ajbrowser" to invoke the script in - <literal>{aspectj}/bin</literal> - (if AspectJ is installed correctly) - or by using the - <literal>aspectjtools.jar</literal> directly, - and specifying no arguments or some number of - build configuration files - (suffix <literal>.lst</literal>): - <programlisting> -java -jar aspectj1.1/lib/aspectjtools.jar aspectj1.1/doc/examples/spacewar/debug.lst - </programlisting> - </para> - - </sect1> - - <sect1 id="ajbrowser-building"> - <title>Building Programs</title> - <sect2 id="build-configurations" xreflabel="build-configurations"> - <title>Build Configurations</title> - - <para>A build configuration is a set of files to compile for a - program (and optionally some additional compile arguments). - Because <literal>ajc</literal> requires all sources to be specified - (at least using the <literal>-sourceroots</literal> option), - most users create <literal>.lst</literal> files that list - the files to compile (one argument per line, globbing - permitted - for more details, see <xref linkend="ajc-ref"/>). - </para> - <para> - To work with a particular program, select the - corresponding ".lst" build configuration file - from the GUI using the File menu, "open" item, - or by using the - "Open Build Configuration" button - (<inlinemediaobject> - <imageobject> - <imagedata fileref="openConfig.gif"/> - </imageobject> - </inlinemediaobject>). - - You can populate the build list from the command line - by passing any number of ".lst" paths. - (However, if you pass in any non-".lst" arguments, - it will run the command-line compiler directly.) - </para> - <para> - To switch between build configurations, - select, add, or remove them - using the corresponding toolbar buttons. - </para> - <para>Global build options are stored in an - <literal>.ajbrowser</literal> file in your HOME directory. - Edit these from the GUI by clicking the "Options" button - or selecting the Tools menu item "Options...". - This is how to set classpath, aspectpath, etc. - </para> - <para>The following sections walk through a build. - </para> - </sect2> - <sect2 id="compiling-a-program-build-configuration" xreflabel="compiling-a-program-build-configuration"> - <title>Compiling a Program Build Configuration</title> - - <para> - To compile click the "Build" button - (<inlinemediaobject> - <imageobject> - <imagedata fileref="build.gif"/> - </imageobject> - </inlinemediaobject>), or - or use the tools menu. - </para> -<!-- - <para>To build using AspectJ 1.1's incremental mode, - click the <literal>incremental compile</literal> checkbox in - the <literal>AspectJ Build Options</literal> tab - of the <literal>Options</literal> dialog. - Once in incremental mode, you can force a full rebuild - by holding the shift key down when selecting the - build menu item or button. - </para> ---> - <para> - You may select - from different build configurations in the GUI - (see label 1 in the graphic below). - (If you get classpath or other errors, set up the - global build options as described above.) - </para> - <para> - <inlinemediaobject> - <imageobject> - <imagedata fileref="ajbrowser-building.gif"/> - </imageobject> - </inlinemediaobject> - </para> - </sect2> - </sect1> - - <sect1 id="ajbrowser-navigating"> - <title>Navigating Program Structure</title> - - <para> - Select nodes in the program structure by clicking them (see label 2). - If one node is related to one or more other nodes by an association the - name of the association will appear below that node and will be - displayed in italics. Links to other structure nodes appear in blue - below the association. If there is no corresponding source for the - link it will appear light-blue. - </para> - <para> - <inlinemediaobject> - <imageobject> - <imagedata fileref="ajbrowser-building.gif"/> - </imageobject> - </inlinemediaobject> - </para> - - <sect2 id="example" xreflabel="example"> - <title>Example: Exploring the "Spacewar" sample code </title> - <para> - <itemizedlist> - - <listitem> <para>Launch <literal>ajbrowser</literal></para> - </listitem> - - <listitem> <para>Choose "File -> Open" or click the "Open Build - Configuration" button - (<inlinemediaobject> - <imageobject> - <imagedata fileref="openConfig.gif"/> - </imageobject> - </inlinemediaobject>) and select the configuration file for debugging - the spacewar example, in - <literal>examples/spacewar/debug.lst</literal>.</para> - </listitem> - - <listitem> <para>Click the "Build" button (<inlinemediaobject> - <imageobject> - <imagedata fileref="build.gif"/> - </imageobject> - </inlinemediaobject>) to - compile. The left pane should fill with a spacewar declaration - tree. If there is a compiler error, the clickable error message - shows up as in label 4. - </para> - - <para>Note: If you did not set up your classpath, the - compile will fail with a message that you need to install - aspectjrt.jar on your compile classpath. To do that, select "Tools - -> Options" or click the "Options" button - (<inlinemediaobject> - <imageobject> - <imagedata fileref="browseroptions.gif"/> - </imageobject> - </inlinemediaobject>). Click the <literal>Build Options</literal> tab - to view the Build Paths pane. Edit the classpath entry to use your - install location. For example, if you ran from the base Aspectj - directory, the classpath need only include - <literal>lib/aspectjrt.jar</literal> (though the browser may populate - the classpath with the bootclasspath and classpath initially.) - Be sure to use the - <literal>lib/aspectjrt.jar</literal> that came with the browser. - </para> - - <para> - <inlinemediaobject> - <imageobject> - <imagedata fileref="ajbrowser-options.gif"/> - </imageobject> - </inlinemediaobject> - </para> - - </listitem> - - <listitem> <para>Different structure views: The structure tree at the - left can display different orderings and granularity for structure: - - <itemizedlist> - <listitem><para>The package hierarchy view shows the traditional hierarchy - of package, class, and members.</para></listitem> - - <listitem><para>The inheritance view shows the hierarchy from topmost - parent classes through subclasses to members.</para></listitem> - - <listitem><para>The crosscutting view shows the aspect members - and the code they affect.</para></listitem> - - <listitem><para>Additional buttons in the pane can be used to change the - granularity and filter out items.</para> - </listitem> - - </itemizedlist> - - </para> - - <para>Whenever you select an item in the tree view, the - source pane scrolls to that item. If you select a leaf item - representing another program element, then the tree - selection will go to the corresponding node. (See below for - how to use two panes to maintain your place.) - </para> - - </listitem> - <listitem> - - <para>When working with aspects, it helps to be able to navigate - between different program elements: - </para> - - <itemizedlist> - - <listitem><para>When looking at a method, find the advice that - affects it. </para></listitem> - - <listitem><para>When looking at a pointcut, find the advice that - uses it. </para></listitem> - - <listitem><para>When looking at advice, find what it advises - - e.g., method calls or executions, initializers, etc. - </para></listitem> - - <listitem><para>When looking at a type, find any aspects that - declare members or supertypes of the type, or - vice-versa. - </para></listitem> - - </itemizedlist> - - <para>You can view the advice on a particular method using the - default, hierarchical view. Navigate to the tree item for - <literal>spacewar.Registry.register(SpaceObject)</literal> - in the <literal>debug.lst</literal> config file. Now, in - the lower, file view, you can see and navigate to the advice - using the subtree whose parent is the <literal>method - affected by</literal> relation. - </para> - - <para>You can also use crosscutting view to see the - advice using a pointcut or the methods affected by advice. - For example, to see what advice uses a particular pointcut, - navigate to the tree item for the pointcut - <literal>spacewar.Debug.allConstructorsCut()</literal> in - the <literal>debug.lst</literal> config file. You can see - and navigate to the advice that uses the pointcut using the - <literal>pointcut used by</literal> relation. - </para> - - <para>As an example of seeing the methods affected by advice, - while still in the same view, select the first - <literal>before</literal> advice in - <literal>spacewar.Debug</literal>. It has relation - sub-trees for both <literal>uses pointcut</literal> and - <literal>affects constructions</literal>. The - <literal>affects</literal> relations will list different - kinds of join points - constructor or method calls, etc. - </para> - <para>Note that the AspectJ browser can only display - static structure (whether hierarchical or crosscutting). - That means that dynamicly-determined pointcuts (like - <literal>cflow(pointcut)</literal>) - will not be shown as picking out static points in - source code. Displayable pointcuts roughly correspond - to those that can be used in a - <literal>declare error</literal> statement. - </para> - </listitem> - </itemizedlist> - </para> - </sect2> - </sect1> - <sect1 id="ajbrowser-running"> - <title>Running Programs</title> - <para> - The browser supports a limited form of running compiled programs. - To run programs that have been built, click the run button - or select one of the run menu items in the project menu. - You can run in the same VM or spawn a new process; - the latter is generally better for GUI programs. - </para> - <para>Both require that any classpath you set be specified - using platform-specific paths and path separators (the - compiler might be more tolerant). - Output and error streams will be - merged into the streams of the browser (using separate - threads, so it may take a few seconds for the pipe - threads to gain control.) Errors should - be detected and displayed in a dialog. - </para> - <para> - The GUI does not support killing a running program, - so if your program might hang, - be sure to save your files since you may need to - kill the browser itself to kill its child processes. - </para> - </sect1> - - <sect1 id="ajbrowser-problems"> - <title>Isolating problems running the AspectJ browser</title> - - <para> - If you have problems with the browser not solved by the documentation, - please try to see if you have the same problems when running ajc - directly on the command line. - </para> - <itemizedlist> - <listitem><para> - If the problem occurs on the command line also, then the problem - is not in the browser. - (It may be in the compiler; please send bug reports.) - </para></listitem> - <listitem><para> - If the problem does not occur on the command line, then it may - lie in the parameters you are supplying in the build options. - </para></listitem> - <listitem><para> - If the build options look correct and the problem only occurs - when building from the browser, then please submit a bug report. - </para></listitem> - </itemizedlist> - - <sect2 id="ajbrowser-knownProblems"> - <title>Known issues with the AspectJ browser</title> - <para> - For the most up-to-date information on known problems, - see the - <ulink url="http://bugs.eclipse.org/bugs">bug database</ulink> - for unresolved - <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=Compiler&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> - compiler bugs - </ulink> or - <ulink url="http://bugs.eclipse.org/bugs/buglist.cgi?&product=AspectJ&component=IDE&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"> - IDE bugs - </ulink>. - </para> - <para> - <itemizedlist> - <listitem><para> - Memory and forking: Users email most about the browser task running - out of memory. - This is not a problem with the browser; some compiles take a lot of - memory, often more than similar compiles using javac. - The browser does not support forking, so the only solution is to - edit the java command line or script that launches the browser - to add memory. - </para></listitem> - <listitem><para> - Editing build configuration files: this is not currently supported. - </para></listitem> - <listitem><para> - The structure model is incomplete after incremental compiles. - To get a complete structure model requires a full build. - </para></listitem> - <listitem><para> - If you change the output directory, you must do a - full build. - </para></listitem> - </itemizedlist> - </para> - </sect2> - <sect2 id="ajbrowser-limitations"> - <title>Limitations</title> - <para> - <itemizedlist> - <listitem><para> - The AJBrowser expects the package and directory structure to match. If they do not - it will be unable to browse to the corresponding file. - </para></listitem> - <listitem><para> - The "Run" feature launches applications in the same VM. As a result, if a Swing application - is disposed the AJBrowser will be disposed as well. - </para></listitem> - </itemizedlist> - </para> - </sect2> - <sect2 id="ajbrowser-feedback"> - <title>AspectJ Browser questions and bugs</title> - <para> - You can send email to - <ulink url="mailto:aspectj-users@dev.eclipse.org"> - aspectj-users@dev.eclipse.org</ulink>. - (Do join the list to participate!) - We also welcome any bug reports, patches, and feature requests; - you can submit them to the bug database at - <ulink url="http://bugs.eclipse.org/bugs"> - http://bugs.eclipse.org/bugs</ulink> - using the AspectJ product and IDE component. - </para> - </sect2> - </sect1> -</chapter> - -<!-- Local variables: --> -<!-- fill-column: 79 --> -<!-- sgml-local-ecat-files: devguide.ced --> -<!-- sgml-parent-document:("devguide.sgml" "book" "refentry") --> -<!-- End: --> - diff --git a/docs/devGuideDB/ajdejbuilder.xml b/docs/devGuideDB/ajdejbuilder.xml index a201dd48d..f8071acc1 100644 --- a/docs/devGuideDB/ajdejbuilder.xml +++ b/docs/devGuideDB/ajdejbuilder.xml @@ -84,18 +84,20 @@ r<refentry> <para> To run the project select "Run Project" from the AspectJ toolbar, or click <ctrl>F12 while the editor pane is active. Note that the - "AspectJ Runtime" library must be added to your project in order to - run. If the library is not added you will see a
"java.lang.NoClassDefFoundError: org/aspectj/lang/Signature" error.
The library is created automatically for you from the runtime + "AspectJ Runtime" library must be added to your project in order to + run. If the library is not added you will see a + "java.lang.NoClassDefFoundError: org/aspectj/lang/Signature" error. + The library is created automatically for you from the runtime in "jbuilderdir/lib/ext". You can also create a new library - to use the runtime from a different location. If you have not added the + to use the runtime from a different location. If you have not added the library to the "Required Libraries" of your project it will be added automatically when you restart JBuilder. </para> <para> - JBuilder7 users please note: when you set up a run/debug configuration - you must select the "Build Target" (at the bottom of the - "Runtime Properties" dialog) to be "<None>". This will ensure - that the Java compiler is not invoked on your AspectJ sources + JBuilder7 users please note: when you set up a run/debug configuration + you must select the "Build Target" (at the bottom of the + "Runtime Properties" dialog) to be "<None>". This will ensure + that the Java compiler is not invoked on your AspectJ sources before running or debugging the project. </para> </refsect1> @@ -105,7 +107,7 @@ r<refentry> <imagedata fileref="jbuilder-structureNavigation.gif" /> </imageobject> <para> - Navigation of program structure is provided by the <xref linkend="ajbrowser">AspectJ Browser</xref>, so apart from a JBuilder + Navigation of program structure is provided by the AspectJ Browser, so apart from a JBuilder look and feel, the extra navigation AspectJ allows work as described there. In particular, you can use views with labels 1, 2 and 4 of the second screenshot to navigate structure using the blue links, and you @@ -117,7 +119,7 @@ r<refentry> <title>Manipulating Build Configurations</title> <para> Build configurations can be manipulated adding, removing, and - editing build configuration files. The <xref linkend="ajbrowser">AspectJ Browser</xref> is used to select the + editing build configuration files. The AspectJ Browser is used to select the current build configuration. Configurations are represented by ".lst" files which are described in the <xref linkend="ajc">ajc</xref> documentation. </para> diff --git a/docs/devGuideDB/devguide.xml b/docs/devGuideDB/devguide.xml index e79ab53a2..90e6e4aec 100644 --- a/docs/devGuideDB/devguide.xml +++ b/docs/devGuideDB/devguide.xml @@ -7,7 +7,6 @@ <!ENTITY ajc SYSTEM "ajc.xml"> <!ENTITY ajdoc SYSTEM "ajdoc.xml"> <!ENTITY antsupport SYSTEM "antsupport.xml"> -<!ENTITY ajbrowser SYSTEM "ajbrowser.xml"> <!ENTITY compatibility SYSTEM "compatibility.xml"> <!ENTITY ltw SYSTEM "ltw.xml"> <!ENTITY tools-intro SYSTEM "tools-intro.xml"> @@ -25,9 +24,9 @@ </authorgroup> <legalnotice> - <para>Copyright (c) 1998-2001 Xerox Corporation, + <para>Copyright (c) 1998-2001 Xerox Corporation, 2002 Palo Alto Research Center, Incorporated, - 2003-2005 Contributors. + 2003-2005 Contributors. All rights reserved. </para> </legalnotice> @@ -35,13 +34,13 @@ <abstract> <para> This guide describes how to build and deploy AspectJ programs - using the AspectJ tools and facilities. See also + using the AspectJ tools and facilities. See also <ulink url="../progguide/index.html">The - AspectJ Programming Guide</ulink>, + AspectJ Programming Guide</ulink>, the documentation available with the AspectJ support available for - various integrated development environments (e.g., - <ulink url="http://eclipse.org/ajdt">Eclipse AJDT</ulink>), - and the most-recent documentation available from + various integrated development environments (e.g., + <ulink url="http://eclipse.org/ajdt">Eclipse AJDT</ulink>), + and the most-recent documentation available from the AspectJ project page, at <ulink url="http://eclipse.org/aspectj"> http://eclipse.org/aspectj</ulink>. @@ -52,29 +51,27 @@ <chapter id="command-line-tools" xreflabel="AspectJ command-line tools"> <title>AspectJ command-line tools</title> - + <sect1 id="ajc-ref-top"> <title><literal>ajc</literal>, the AspectJ compiler/weaver</title> - &ajc; + &ajc; </sect1> <sect1 id="ajdoc-ref-top"> <title><literal>ajdoc</literal>, the AspectJ documentation tool</title> <para><literal>ajdoc</literal> produces JavaDoc-style documentation including crosscutting information.</para> - &ajdoc; + &ajdoc; </sect1> <sect1 id="aj-ref-top"> <title><literal>aj</literal>, the AspectJ load-time weaving script</title> <para><literal>aj</literal> launches programs, configuring basic load-time weaving.</para> - &aj; + &aj; </sect1> </chapter> - - &ajbrowser; + &antsupport; <w; &compatibility; </book> - diff --git a/docs/devGuideDB/tools-intro.xml b/docs/devGuideDB/tools-intro.xml index ab29d0c21..bc6051489 100644 --- a/docs/devGuideDB/tools-intro.xml +++ b/docs/devGuideDB/tools-intro.xml @@ -1,14 +1,14 @@ -<chapter id="tools-intro" +<chapter id="tools-intro" xreflabel="Introduction to the AspectJ tools"> <title>Introduction to the AspectJ tools</title> -<sect1 +<sect1 id="eclipse-aspectj" xreflabel="The Eclipse AspectJ implementation"> <title>The Eclipse AspectJ implementation</title> <para>The <ulink url="../progguide/index.html">AspectJ Programming Guide</ulink> describes the AspectJ language. This guide describes the AspectJ tools produced by the AspectJ - team on + team on <ulink url="http://eclipse.org/aspectj">http://eclipse.org/aspectj</ulink>. The AspectJ tools include - ajc, the compiler/weaver; @@ -25,46 +25,46 @@ classes. </para> <para> - Since AspectJ 1.1, the tools have implemented the AspectJ language + Since AspectJ 1.1, the tools have implemented the AspectJ language using bytecode weaving, which combines aspects and classes to produce .class files that run in a Java VM. There are other ways to implement the language (e.g., compiler preprocessor, VM support); the AspectJ team has always tried to distinguish the language and the implementation so other groups could build alternative implementations of AspectJ. To that end, - + <ulink url="../progguide/implementation.html">The AspectJ Programming Guide, Implementation Notes</ulink> describes how the Java bytecode form affects language semantics. VM- or source-based implementations may be free of these limits or impose limits of their own, but most should be fairly close to what's possible in Java bytecode. </para> - <para> + <para> Please be careful not to confuse any description of weaving or of this implementation of the AspectJ language with the AspectJ language semantics. If you do, you might find yourself writing code that doesn't work as - expected when you compile or run it on other systems. + expected when you compile or run it on other systems. More importantly, if you think about aspects in terms of weaving or of inserting or merging code, then you can lose many of the design benefits of thinking - about an aspect as a single crosscutting module. + about an aspect as a single crosscutting module. When the text below introduces an implementation detail, it will warn if users make mistakes by applying it in lieu of the language semantics. </para> </sect1> <!-- graphic for bytecode weaving --> -<sect1 +<sect1 id="bytecode-concepts" xreflabel="Bytecode weaving, incremental compilation, and memory usage"> <title>Bytecode weaving, incremental compilation, and memory usage</title> <para>Bytecode weaving takes classes and aspects in .class form - and weaves them together to produce binary-compatible .class files that + and weaves them together to produce binary-compatible .class files that run in any Java VM and implement the AspectJ semantics. This process supports not only the compiler but also IDE's. The compiler, given an aspect in source form, produces a binary aspect and runs the weaver. IDE's can get information about - crosscutting in the program by subscribing to information + crosscutting in the program by subscribing to information produced by weaver as a side-effect of weaving. </para> <para>Incremental compilation involves recompiling only what is necessary @@ -73,7 +73,7 @@ Incremental weaving supports this by weaving on a per-class basis. (Some implementations of AOP (including AspectJ 1.0) make use of whole-program analysis that can't be done in incremental mode.) - Weaving per-class means that if the source for a pure Java class + Weaving per-class means that if the source for a pure Java class is updated, only that class needs to be produced. However, if some crosscutting specification may have been updated, then all code potentially affected by it may need to be woven. The AspectJ @@ -89,16 +89,15 @@ (While it may seem like more memory, the proper comparison would with with a Java program that had the same crosscutting, with changes made to each code segment. That would likely require - more memory and more time to recompile than the corresponding + more memory and more time to recompile than the corresponding AspectJ program.) </para> -<sect2 +<sect2 id="classpathInpathAndAspectpath" xreflabel="Classpath, inpath, and aspectpath"> <title>Classpath, inpath, and aspectpath</title> <para>AspectJ introduces two new paths for the binary input to the weaver which you'll find referenced in <xref linkend="ajc-ref"/>, - <xref linkend="ajbrowser"/>, <xref linkend="antTasks"/>, and <xref linkend="ltw"/>. </para> @@ -109,28 +108,28 @@ </para> <para> In AspectJ tools, the <literal>aspectpath</literal> is where to find binary - aspects. Like the classpath, it can include archives (.jar and .zip files) - and directories containing .class files in a package layout (since + aspects. Like the classpath, it can include archives (.jar and .zip files) + and directories containing .class files in a package layout (since binary aspects are in .class files). These aspects affect other classes in exactly the same way as source-level aspects, but are themselves - not affected. When deploying programs, the original aspects must be included + not affected. When deploying programs, the original aspects must be included on the runtime classpath. </para> <para> In AspectJ tools, the <literal>inpath</literal> is where to find binary - input - aspects and classes that weave and may be woven. - Like the classpath, it can include archives and class directories. + input - aspects and classes that weave and may be woven. + Like the classpath, it can include archives and class directories. Like the aspectpath, it can include aspects that affect other classes and aspects. However, unlike the aspectpath, an aspect on the inpath may itself be affected by aspects, as if the source were all compiled together. - When deploying aspects that were put on the inpath, only the woven output + When deploying aspects that were put on the inpath, only the woven output should be on the runtime classpath. </para> <para> Although types in the inpath and the aspectpath need to be resolved by the AspectJ tools, you usually do not need to place them on the classpath - because this is done automatically by the compiler/weaver. But when using + because this is done automatically by the compiler/weaver. But when using the <literal>WeavingURLClassLoader</literal>, your code must explicitly add the aspects to the classpath so they can be resolved (as you'll see in the sample code and the <literal>aj.bat</literal> script). @@ -140,18 +139,18 @@ weaving with binary aspects, users forget to deploy the aspect itself along with any classes it requires. A more subtle mistake is putting a binary aspect (BA) on the inpath instead of the aspectpath. In this case - the aspect BA might be affected by an aspect, even itself; this can - cause the program to fail, e.g., when an aspect uses exclusion to + the aspect BA might be affected by an aspect, even itself; this can + cause the program to fail, e.g., when an aspect uses exclusion to avoid infinite recursion but fails to exclude advice in aspect BA. </para> <para>The latter is one of many ways that mistakes in the build process can affect aspects that are written poorly. Aspects should never rely on the boundaries of the build specification to narrow the - scope of their crosscutting, since the build can be changed + scope of their crosscutting, since the build can be changed without notice to the aspect developer. Careful users might even avoid relying on the implementation scope, to ensure their AspectJ code will run on other implementations. </para> </sect2> </sect1> -</chapter>
\ No newline at end of file +</chapter> diff --git a/docs/developer/BUILD.md b/docs/developer/BUILD.md index d19c4013d..2cc8bfff5 100644 --- a/docs/developer/BUILD.md +++ b/docs/developer/BUILD.md @@ -110,12 +110,16 @@ Other existing profiles, which developers are less likely to actively use becaus profile is inactive by default, because in the context of a Maven build it would cause all tests to be run twice (during module build and again when running the big suite), hence the profile name. - * `jdk-8-to-15` - Activated automatically on JDKs 8-15, setting property `jvm.arg.addOpens` to an empty value, because - it is only needed on JDK 16+, see next bullet point. + * `jdk-8-to-15` - Activated automatically on JDKs 8-15, setting properties `jvm.arg.addOpens` and + `jvm.arg.allowSecurityManager` to empty values, because they are only needed on JDK 16+ or 18+, respectively. See + next bullet point. * `jdk-16-to-xx` - Activated automatically on JDKs 16+, setting property `jvm.arg.addOpens` to value `--add-opens java.base/java.lang=ALL-UNNAMED`, which is needed in order to run LTW tests. + * `jdk-18-to-xx` - Activated automatically on JDKs 18+, setting property `jvm.arg.allowSecurityManager` to value + `-Djava.security.manager=allow`, which is needed by some tests in order to override `System.exit`. + ### Build properties The following properties and their default values in different profile are used in order to activate or skip Maven diff --git a/docs/developer/IDE.md b/docs/developer/IDE.md index 98a74dafd..2dc560008 100644 --- a/docs/developer/IDE.md +++ b/docs/developer/IDE.md @@ -11,8 +11,8 @@ the AspectJ Compiler _ajc_ from the command line. Please refer to the [AspectJ Development Environment Guide](https://www.eclipse.org/aspectj/doc/next/devguide/printable.html) for more details about on-board AspectJ tools, such as _ajc_ (compiler), _ajdoc_ (aspect-enriched Javadoc), _aj_ -(load-time weaving helper), AspectJ Browser (simple visualisation tool for cross-cutting aspect structure) as well as -basic information about load-time weaving configuration and the built-in Ant task for AspectJ. +(load-time weaving helper) as well as basic information about load-time weaving configuration and the built-in Ant task +for AspectJ. ## IDE support @@ -32,9 +32,10 @@ projects using AspectJ Maven Plugin. #### AspectJ Development Tools (AJDT) Use an update sites corresponding to your Eclipse version (minimal version listed): -* Eclipse 2021-09 (4.21): https://download.eclipse.org/tools/ajdt/421/dev/update -* Eclipse 2021-03 (4.19): https://download.eclipse.org/tools/ajdt/419/dev/update -* Eclipse 2018-12 (4.10): https://download.eclipse.org/tools/ajdt/410/dev/update +* Eclipse 2022-03 (4.23), AspectJ 1.9.9, Java 18: https://download.eclipse.org/tools/ajdt/423/dev/update +* Eclipse 2021-09 (4.21), AspectJ 1.9.8, Java 17: https://download.eclipse.org/tools/ajdt/421/dev/update +* Eclipse 2021-03 (4.19), AspectJ 1.9.7, Java 16: https://download.eclipse.org/tools/ajdt/419/dev/update +* Eclipse 2018-12 (4.10), AspectJ 1.9.6, Java 14: https://download.eclipse.org/tools/ajdt/410/dev/update * For older versions, please refer to https://www.eclipse.org/ajdt/downloads (page was not updated in a long time, and I have no write access). @@ -88,6 +89,19 @@ As mentioned in the introduction, AspectJ features its own Ant task, which is de [this chapter](https://www.eclipse.org/aspectj/doc/next/devguide/printable.html#antTasks) of the Development Environment Guide. +### Command line + +If you wish to install AspectJ in a separate directory and use it from the command line without any extra build tools, +feel free to download the **AspectJ installer**. It is and executable JAR installer. It requires Java and possibly admin +rights, if e.g. under Windows you want to install AspectJ to _C:/Program Files/AspectJ_. You execute it from a command +prompt via `java -jar installer-<version>.jar` and select your installation options. Then you add `<ASPECTJ_HOME>/bin` +to your path and are good to go. You can now call tools like the Aspectj compiler `ajc` or the AspectJ documentation +generator `ajdoc` (similar to Javadoc) from the command line. + +You can find older installer versions until 1.9.6 on the [AspectJ website](https://www.eclipse.org/aspectj/downloads.php), +more recent ones are attached to AspectJ [GitHub releases](https://github.com/eclipse/org.aspectj/releases) as +_aspectj-*jar_. + ## Biased recommendation Feel free to be skeptical, because the author has both IDE and build tool biases, but I am recommending Maven as a build diff --git a/docs/developer/modules.html b/docs/developer/modules.html index 6989c81a3..0aa3e8cfd 100644 --- a/docs/developer/modules.html +++ b/docs/developer/modules.html @@ -8,9 +8,9 @@ <title>AspectJ modules</title> <STYLE TYPE="text/css"> <!-- - + /* FOR THE SDA PAGE */ - + /* BODY {margin-top: 15px; margin-left: 15px; margin-right: 15px;} */ @@ -24,116 +24,116 @@ A:hover { color:red } - + INPUT {font:12px "Courier New", sans-serif;} - + H2 { - font:18px/18px Verdana, Arial, Helvetica, sans-serif; - color:black; - font-weight:bold; + font:18px/18px Verdana, Arial, Helvetica, sans-serif; + color:black; + font-weight:bold; margin-left: 10px; - line-height:110%; + line-height:110%; } H3 { - font:18px/18px Verdana, Arial, Helvetica, sans-serif; - color:black; - font-weight:bold; + font:18px/18px Verdana, Arial, Helvetica, sans-serif; + color:black; + font-weight:bold; margin-left: 10px; - line-height:110%; + line-height:110%; } H4 { - font:15px/16px Verdana, Arial, Helvetica, sans-serif; - color:black; - font-weight:bold; + font:15px/16px Verdana, Arial, Helvetica, sans-serif; + color:black; + font-weight:bold; margin-left: 10px; line-height:140%; } P { - font:13px/13px Verdana, Arial, Helvetica, sans-serif; + font:13px/13px Verdana, Arial, Helvetica, sans-serif; margin-right: 10px; margin-left: 10px; - line-height:130%; + line-height:130%; } .paragraph { - font:13px/13px Verdana, Arial, Helvetica, sans-serif; + font:13px/13px Verdana, Arial, Helvetica, sans-serif; margin-right: 10px; margin-left: 10px; - line-height:130%; + line-height:130%; } .smallParagraph { - font:11px/11px Verdana, Arial, Helvetica, sans-serif; + font:11px/11px Verdana, Arial, Helvetica, sans-serif; margin-right: 10px; margin-left: 10px; - line-height:130%; + line-height:130%; } LI { font:13px/13px Verdana, Arial, Helvetica, sans-serif; - text-align:justify; + text-align:justify; margin-right: 10px; margin-left: 15px; - line-height:120%; + line-height:120%; } /* UL { font:13px/13px Verdana, Arial, Helvetica, sans-serif; - text-align:justify; + text-align:justify; margin-right: 10px; margin-left: 15px; - line-height:120%; + line-height:120%; }*/ - + DL { font:13px/13px Verdana, Arial, Helvetica, sans-serif; - text-align:justify; + text-align:justify; margin-right: 10px; margin-left: 15px; - line-height:120%; + line-height:120%; } - B { font:13px/13px Verdana, Arial, Helvetica, sans-serif; - font-weight:bold; + B { font:13px/13px Verdana, Arial, Helvetica, sans-serif; + font-weight:bold; line-height:140%; } .footer { - font:10px/10px Verdana, Arial, Helvetica, sans-serif; - color:#888888; + font:10px/10px Verdana, Arial, Helvetica, sans-serif; + color:#888888; text-align:left } .figureTitle { - font:13px/13px Verdana, Arial, Helvetica, sans-serif; - text-align:justify; + font:13px/13px Verdana, Arial, Helvetica, sans-serif; + text-align:justify; text-align:center } .copyrightNotice { - font:10px/10px Verdana, Arial, Helvetica, sans-serif; - color:#999999; + font:10px/10px Verdana, Arial, Helvetica, sans-serif; + color:#999999; line-height:110%; } .smallHeading { - font:13px/13px Verdana, Arial, Helvetica, sans-serif; + font:13px/13px Verdana, Arial, Helvetica, sans-serif; font-weight:bold; line-height:110%; } .tinyHeading { - font:11px/11px Verdana, Arial, Helvetica, sans-serif; + font:11px/11px Verdana, Arial, Helvetica, sans-serif; font-weight:bold; line-height:120%; } .newsText { - font:11px/11px Verdana, Arial, Helvetica, sans-serif; + font:11px/11px Verdana, Arial, Helvetica, sans-serif; line-height:130%; } .smallParagraph { - font:11px/11px Verdana, Arial, Helvetica, sans-serif; + font:11px/11px Verdana, Arial, Helvetica, sans-serif; line-height:130%; } .fancyHeading { - font:20px/20px Chantilly, Arial, Helvetica, sans-serif; + font:20px/20px Chantilly, Arial, Helvetica, sans-serif; margin-right: 10px; color:#6f7a92; margin-left: 10px; line-height:130%; } - + --> </STYLE> </head> @@ -142,19 +142,19 @@ <h3 align="center">AspectJ Modules</h3> -<p>There are a number of different structures [Parnas]: "the module structure, -the uses structure, the runtime structure, .." This document overviews module structure and summarizes what is hidden by each. -For detailed documentation refer to the individual module sources and docs +<p>There are a number of different structures [Parnas]: "the module structure, +the uses structure, the runtime structure, .." This document overviews module structure and summarizes what is hidden by each. +For detailed documentation refer to the individual module sources and docs available via CVS. </p> <h4 align="center">Core Modules</h4> <p><b>CVS Location: </b>dev.eclipse.org:/cvsroot/technology/org.aspectj/modules</p> <p> -To set up for building, one need only check out the module directories within the +To set up for building, one need only check out the module directories within the <code>modules/</code> directory. In Eclipse, check out each module into the the workspace as a project. (Note: module dependencies may change at any time, so this documentation might be out of date. -The Eclipse .classpath files specify the module dependencies, +The Eclipse .classpath files specify the module dependencies, even when using Ant to build outside of Eclipse.) <p> @@ -172,32 +172,32 @@ even when using Ant to build outside of Eclipse.) <td bgColor="#eeeeee"> <p class="smallParagraph" align="left">ajbrowser</td> <td bgColor="#eeeeee"> - <p class="smallParagraph" align="left">ajde, asm, bridge, util, taskdefs + <p class="smallParagraph" align="left">ajde, asm, bridge, util, taskdefs (pseudo, for build system) </td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - This module contains the ajbrowser application. It depends on the ajde module -for access to the aspectj compiler, and also for the swing user interface + This retired module used to contain the ajbrowser application. It depends on the ajde module +for access to the aspectj compiler, and also for the swing user interface components that ajde provides.</td> </tr> <tr> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left">ajde</td> <td bgColor="#eeeeee"> - <p class="smallParagraph" align="left">asm, bridge, + <p class="smallParagraph" align="left">asm, bridge, org.aspectj.ajdt.core, org.eclipse.jdt.core, util</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Hides the details of accessing the aspectj compiler - and interpreting compilation results (error messages, structure - model, etc.) from other applications (typically IDEs) that need + Hides the details of accessing the aspectj compiler + and interpreting compilation results (error messages, structure + model, etc.) from other applications (typically IDEs) that need to invoke it programmatically. - Changing any public interface in ajde can break all the IDE + Changing any public interface in ajde can break all the IDE integration projects and should be done with care.<br> <br> - It also contains a library of common swing user interface - components that can be used by any swing based IDE. Ajbrowser - and the non-eclipse IDE integration projects use this library + It also contains a library of common swing user interface + components that can be used by any swing based IDE. Ajbrowser + and the non-eclipse IDE integration projects use this library (except for the emacs support).</td> </tr> <tr> @@ -207,8 +207,8 @@ components that ajde provides.</td> <p class="smallParagraph" align="left">bridge</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Contains the Abstract Structure Model, which represents the result of -an aspectj compilation. Clients of ajde are returned an instance of the + Contains the Abstract Structure Model, which represents the result of +an aspectj compilation. Clients of ajde are returned an instance of the structure model which allows them to navigate and interpret the static structure of an aspectj program.</td> </tr> <tr> @@ -218,22 +218,22 @@ structure model which allows them to navigate and interpret the static structure <p class="smallParagraph" align="left">util</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Contains an interface and implementation of classes realted to - compiler messages including: source locations, handling, and - formatting. Intended to minimize dependencies between + Contains an interface and implementation of classes realted to + compiler messages including: source locations, handling, and + formatting. Intended to minimize dependencies between testing, the compiler, and ajde.</td> </tr> <tr> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left">org.aspectj.ajdt.core</td> <td bgColor="#eeeeee"> - <p class="smallParagraph" align="left">asm, bridge, org.eclipse.jdt.core, + <p class="smallParagraph" align="left">asm, bridge, org.eclipse.jdt.core, runtime, testing-util, util, weaver</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Front-end of the AspectJ compiler and extension of Eclipse's JDT compiler. - Extends the JDT compiler's parsing and name resolution to - understand AspectJ declarations. Also extends incremental + Front-end of the AspectJ compiler and extension of Eclipse's JDT compiler. + Extends the JDT compiler's parsing and name resolution to + understand AspectJ declarations. Also extends incremental behavior with understanding of AspectJ dependancies.</td> </tr> <tr> @@ -257,14 +257,14 @@ structure model which allows them to navigate and interpret the static structure <p class="smallParagraph" align="left"> </td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Small runtime library required for building and running AspectJ + Small runtime library required for building and running AspectJ programs.</td> </tr> <tr> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left">taskdefs</td> <td bgColor="#eeeeee"> - <p class="smallParagraph" align="left">bridge, org.aspectj.ajdt.core, + <p class="smallParagraph" align="left">bridge, org.aspectj.ajdt.core, util</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> @@ -277,20 +277,20 @@ structure model which allows them to navigate and interpret the static structure <p class="smallParagraph" align="left"> </td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Common utility classes including data type, file, and stream + Common utility classes including data type, file, and stream manipulation.</td> </tr> <tr> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left">weaver</td> <td bgColor="#eeeeee"> - <p class="smallParagraph" align="left">asm, bridge, runtime, testing-util, + <p class="smallParagraph" align="left">asm, bridge, runtime, testing-util, util</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Back-end of the AspectJ compiler, built on top of the BCEL - bytecode toolkit. All advice planning and weaving is done - here. Takes an aspect bytecode format and other Java + Back-end of the AspectJ compiler, built on top of the BCEL + bytecode toolkit. All advice planning and weaving is done + here. Takes an aspect bytecode format and other Java classfiles as input. </td> </tr> <!-- @@ -325,7 +325,7 @@ structure model which allows them to navigate and interpret the static structure <p class="smallParagraph" align="left">build</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Ant files, scripts, and taskdefs required for building the + Ant files, scripts, and taskdefs required for building the AspectJ distribution. Also contains the GUI installer.</td> </tr> <tr> @@ -368,7 +368,7 @@ structure model which allows them to navigate and interpret the static structure <p class="smallParagraph" align="left">testing-util</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - Common testing utility classes used by the unit test suites in + Common testing utility classes used by the unit test suites in the core modules.</td> </tr> <tr> @@ -376,7 +376,7 @@ structure model which allows them to navigate and interpret the static structure <p class="smallParagraph" align="left">tests</td> <td bgColor="#eeeeee"> <p class="smallParagraph" align="left"> - AspectJ test suite, including all language tests, regression + AspectJ test suite, including all language tests, regression tests, and test system sources.</td> </tr> <!-- @@ -562,4 +562,4 @@ cvs.aspectj4emacs.sourceforge.net:/cvsroot/aspectj4emacs</span></b></p> </body> -</html>
\ No newline at end of file +</html> diff --git a/docs/dist/README-AspectJ.html b/docs/dist/README-AspectJ.html index e7bd6fcf1..5a020832e 100644 --- a/docs/dist/README-AspectJ.html +++ b/docs/dist/README-AspectJ.html @@ -149,20 +149,14 @@ <UL> <li>the <a href="bin"><CODE><aspectj install dir>/bin</CODE></a> - directory has scripts for + directory has scripts for <ul> <li><CODE>ajc</CODE>: the compiler for the AspectJ language</li> - <!-- XXX removed references to ajdoc and ajdb --> - <li><CODE>ajbrowser</CODE>: a graphical editor for - compiling programs with <CODE>ajc</CODE> - and navigating the crosscutting structure of those programs</li> - </ul> - <li>the directory <a href="lib"><CODE><aspectj install dir>/lib</CODE></a> has the AspectJ binaries, <ul> - <li><CODE><a href="lib/aspectjtools.jar">aspectjtools.jar</a></CODE>: libraries for + <li><CODE><a href="lib/aspectjtools.jar">aspectjtools.jar</a></CODE>: libraries for <code>ajc</code>, <code>ajbrowser</code>, and the Ant tasks</li> <li><CODE>aspectjrt.jar</CODE>: runtime library for AspectJ programs</li> @@ -185,9 +179,9 @@ <h3>2 Install Procedure</h3> -<p>The AspectJ tools <code>ajc</code> and <code>ajbrowser</code> are -Java programs that can be run indirectly from the scripts or -directly from <code>aspectjtools.jar</code>. +<p>The AspectJ tool <code>ajc</code> is a +Java program that can be run indirectly from the scripts or +directly from <code>aspectjtools.jar</code>. The <code>aspectjrt.jar</code> needs to be on the classpath when compiling or running programs compiled by <code>ajc</code>. This procedure shows ways to do that. @@ -196,11 +190,11 @@ by <code>ajc</code>. This procedure shows ways to do that. <p>After finishing automatic installation, we recommend that the following steps to complete your installation:</p> - <p><b>2.1 Add <CODE><aspectj install dir>/lib/aspectjrt.jar</CODE> + <p><b>2.1 Add <CODE><aspectj install dir>/lib/aspectjrt.jar</CODE> to your class path</b></p> <blockquote> - <p>This small .jar file contains classes required to compile programs + <p>This small .jar file contains classes required to compile programs with the ajc compiler, and to run programs compiled with the ajc compiler. You must have these classes somewhere on your class path when running programs compiled with ajc. For detailed instructions @@ -236,21 +230,7 @@ to create short launch scripts to start ajc easily (section 3).</p> <p>If you did not use the automatic installation process or the default launch scripts do not work on your system, you may wish to -create short launch scripts to start ajc easily. </p> - -<p>You can also run the <code>aspectjtools.jar</code> directly -using java's -jar option: - -<blockquote> -<CODE>C:\jdk1.3\bin\java.exe -jar D:\aspectj\lib\aspectjtools.jar %*</CODE> -</blockquote> - -<p>With no arguments or only argument list (.lst) files, this will launch -<code>ajbrowser</code>, the GUI structure browser; otherwise, it will -run <code>ajc</code>, the AspectJ compiler. This means that -if your browser is set up to run jar files, clicking a link -to <a href="lib/aspectjtools.jar">lib/aspectjtools.jar</a> will -launch <code>ajbrowser</code>. +create short launch scripts to start ajc easily.</p> <p> You can also create scripts like those created by the installer. These scripts use full paths that are system dependent so you will diff --git a/docs/dist/doc/JavaVersionCompatibility.md b/docs/dist/doc/JavaVersionCompatibility.md new file mode 100644 index 000000000..3bf81891f --- /dev/null +++ b/docs/dist/doc/JavaVersionCompatibility.md @@ -0,0 +1,29 @@ +# AspectJ Java version compatibility + +For reasons described e.g. in [this comment](https://github.com/eclipse/org.aspectj/issues/139#issuecomment-1072946123), +for AspectJ users it has become a little challenging to find out which minimum AspectJ version is required in order to +process byte code or compile source code using features of a certain Java language version. Since Java 10, this cannot +be easily concluded from the AspectJ version number anymore, and we are sorry for that. So here is a little overview: + +AspectJ version | Java version | Comments +----------------|--------------|-------- +1.9.9 - 1.9.9.1 | 18 +1.9.8 | 17 | AspectJ compiler requires JDK 11+ during build time. During runtime, AspectJ still only requires Java 8+ for both compile-time and load-time weaving. Pure Java code can be compiled down to as old as 1.3 byte code level. +1.9.7 | 15, 16 +1.9.6 | 14 +1.9.5 | 13 +1.9.3 - 1.9.4 | 12 +1.9.2 | 11 +1.9.1 | 10 +1.9.0 | 9 +1.8.0 - 1.8.14 | 8 +1.7.0 - 1.7.4 | 7 +1.6.0 - 1.6.12 | 6 +1.5.0 - 1.5.4 | 5 + +Older versions omitted. + +FYI, here is a brief overview of +[Java language changes since Java 9](https://docs.oracle.com/en/java/javase/18/language/java-language-changes.html). +They basically correspond to the new Java language features supported by AspectJ versions for the respective Java +versions. diff --git a/docs/dist/doc/README-198.html b/docs/dist/doc/README-198.html index 5beb81e3d..6b79b5ab9 100644 --- a/docs/dist/doc/README-198.html +++ b/docs/dist/doc/README-198.html @@ -73,7 +73,8 @@ Cross-compilation to legacy JDK </a>: An example class which only works correctly on JDK 8 when compiled with <tt>--release 8</tt> due to API changes in - the JDK. Simply <tt>-source 8 -target 8</tt> would not be enough in this case.</li> + the JDK. Simply <tt>-source 8 -target 8</tt> would not be enough in this case. + </li> <li> <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/features198/java17"> Pattern matching for switch @@ -110,12 +111,6 @@ craft a condy class with ASM</a>. </li> <li> - Improvements for <tt>if()</tt> pointcuts in annotation syntax, see issues - <a href="https://github.com/eclipse/org.aspectj/issues/115">#115</a>, - <a href="https://github.com/eclipse/org.aspectj/issues/120">#120</a>, - <a href="https://github.com/eclipse/org.aspectj/issues/122">#122</a>. - </li> - <li> Thanks to Andrey Turbanov for several clean code contributions and to Dmitry Mikhaylov for fixing a potential concurrency problem. </li> diff --git a/docs/dist/doc/README-199.html b/docs/dist/doc/README-199.html new file mode 100644 index 000000000..2e05e104e --- /dev/null +++ b/docs/dist/doc/README-199.html @@ -0,0 +1,158 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<html> + +<head> +<title>AspectJ 1.9.9 Readme</title> +<style type="text/css"> + <!-- + P { margin-left: 20px; } + PRE { margin-left: 20px; } + LI { margin-left: 20px; } + H4 { margin-left: 20px; } + H3 { margin-left: 10px; } + --> +</style> +</head> + +<body> +<div align="right"><small>© Copyright 2022 Contributors. All rights reserved.</small></div> + +<h1>AspectJ 1.9.9.1</h1> + +<p> + Bugfix release for some compiler options related to the Java Platform Module System (JPMS) which were not working, + most importantly <tt>--add-modules</tt>, <tt>--add-exports</tt> and <tt>--add-reads</tt>. See issue + <a href="https://github.com/eclipse/org.aspectj/issues/145">#145</a>. +</p> +<p> + This probably was broken for a long time. AspectJ still is not boasting extensive JPMS support or test coverage, but + this improvement seems substantial enough to justify a minor release, instead of keeping users waiting for the next + regular release. +</p> + +<h1>AspectJ 1.9.9</h1> + +<p> + Please note that Bugzilla for issue management is deprecated and new issues should be filed as + <a href="https://github.com/eclipse/org.aspectj/issues/new">GitHub issues</a>. + The list of issues addressed for 1.9.9 can be found here: + <ul> + <li><a href="https://github.com/eclipse/org.aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.9">GitHub 1.9.9</a></li> + <li><a href="https://github.com/eclipse/org.aspectj/issues?q=is%3Aissue+is%3Aclosed++milestone%3A1.9.9.1">GitHub 1.9.9.1</a></li> + <li><a href="https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&f0=OP&f1=OP&f3=CP&f4=CP&j1=OR&list_id=16866879&product=AspectJ&query_format=advanced&target_milestone=1.9.9">Bugzilla 1.9.9</a></li> + </ul> +</p> + +<h2>New features</h2> + +<p> + AspectJ 1.9.9 supports <a href="https://openjdk.java.net/projects/jdk/18/">Java 18</a> and its final and preview + features, such as: +</p> +<ul> + <li>Pattern matching for <tt>switch</tt> (preview 2)</li> +</ul> + +<h2>Improvements</h2> + +<p> + In annotation style aspects, asynchronous <tt>proceed()</tt> calls in <tt>@Around</tt> advice now works in threads + created from within the advice. Previously, this was only working in native syntax aspects. There is still a + limitation with regard to asynchronous proceed, if you do not create the thread in the advice but want to use e.g. + an <tt>ExecutorService</tt> with its own thread pool. This still is not working in annotation style aspects, only in + native syntax ones. +</p> +<p> + See <a href="https://github.com/eclipse/org.aspectj/issues/128">issue #128</a> and + <a href="https://github.com/eclipse/org.aspectj/pull/132">pull request #132</a> for more details. +</p> +<h2>Code examples</h2> + +<p> + You can find some sample code in the AspectJ test suite under the respective AspectJ version in which the features + were first supported (possibly as JVM preview features): +</p> +<ul> + <li> + <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/features198/java17"> + Pattern matching for switch, preview 1 + </a> + </li> + <li> + <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/features199/java18"> + Pattern matching for switch, preview 2 + </a> + </li> + <li> + <a href="https://github.com/eclipse/org.aspectj/tree/master/tests/bugs199/github_128"> + Asynchronous proceed in native vs. annotation style syntax + </a> + </li> +</ul> + +<h2>Other changes and bug fixes</h2> + +<ul> + <li> + Fix a bug which led to <tt>NullPointerException</tt>s if too many JAR archives were on the classpath. Too many here + means the value system property <tt>org.aspectj.weaver.openarchives</tt> (1,000 by default). The AspectJ compiler is + meant to close archives upon cache exhaustion and then re-open them if it needs them again later. Re-opening was + broken, now the compiler works reliably even for cache sizes as small as 20. See issue + <a href="https://github.com/eclipse/org.aspectj/issues/125">#125</a>. + </li> + <li> + Improvements for <tt>if()</tt> pointcuts in annotation syntax, see issues + <a href="https://github.com/eclipse/org.aspectj/issues/115">#115</a>, + <a href="https://github.com/eclipse/org.aspectj/issues/120">#120</a>, + <a href="https://github.com/eclipse/org.aspectj/issues/122">#122</a>. + </li> + <li> + Thanks to Andrey Turbanov for several clean code contributions. + </li> +</ul> + +<h2>AspectJ usage hints</h2> + +<h3>AspectJ compiler build system requirements</h3> + +<p> + Since 1.9.7, the AspectJ compiler <tt>ajc</tt> (contained in the <tt>aspectjtools</tt> library) no longer works on + JDKs 8 to 10. The minimum compile-time requirement is now JDK 11 due to upstream changes in the Eclipse Java Compiler + (subset of JDT Core), which AspectJ is a fork of. You can still compile to legacy target versions as low as Java 1.3 + when compiling plain Java code or using plain Java ITD constructs which do not require the AspectJ runtime + <tt>aspectjrt</tt>, but the compiler itself needs JDK 11+. Just like in previous AspectJ versions, both the runtime + <tt>aspectjrt</tt> and the load-time weaver <tt>aspectjweaver</tt> still only require JRE 8+. +</p> + +<h3>Use LTW on Java 16+</h3> + +<p> + Please note that if you want to use load-time weaving on Java 16+, the weaving agent collides with + <a href="https://openjdk.java.net/jeps/396">JEP 396 (Strongly Encapsulate JDK Internals by Default)</a> and related + subsequent JEPs. Therefore, you need to set the JVM parameter <tt>--add-opens java.base/java.lang=ALL-UNNAMED</tt> in + order to enable aspect weaving. This is due to the fact that the weaver uses internal APIs for which we have not found + an adequate replacement yet when defining classes in different classloaders. +</p> + +<h3>Compile with Java preview features</h3> + +<p> + For features marked as preview on a given JDK, you need to compile with <tt>ajc --enable-preview</tt> and run with + <tt>java --enable-preview</tt> on that JDK. +</p> +<p> + Please note that you cannot run code compiled with preview features on any other JDK than the one used for + compilation. For example, records compiled with preview on JDK 15 cannot be used on JDK 16 without recompilation. This + is a JVM limitation unrelated to AspectJ. Also, e.g. sealed classes are preview-1 on JDK 15 and preview-2 on JDK 16. + You still need to recompile, no matter what. +</p> + +<hr> + +<p> + <b>Available:</b> 1.9.9 on 24-Mar-2022, 1.9.9.1 on 31-Mar-2022 +</p> + +</body> + +</html> diff --git a/docs/dist/doc/index.html b/docs/dist/doc/index.html index 36bba4821..371961da2 100644 --- a/docs/dist/doc/index.html +++ b/docs/dist/doc/index.html @@ -105,8 +105,6 @@ </td> <td>This is a guide to <a href="devguide/ajc-ref.html">ajc</a>, the command-line compiler; - <a href="devguide/ajbrowser.html">ajbrowser</a>, the stand-alone - GUI for compiling and viewing crosscutting structure; and the <a href="devguide/antTasks.html">Ant tasks</a> for building AspectJ programs. </td> @@ -320,10 +318,9 @@ see the <a href="progguide/examples.html">Examples </a> section in the <a href="progguide/index.html">Programming Guide</a>. View and navigate the crosscutting structure using - <a href="http://eclipse.org/ajdt">AJDT</a>; if you can't use Eclipse, try - the <code>ajbrowser</code> structure viewer, as described in - the <a href="devguide/ajbrowser.html">AspectJ Browser</a> section of - the <a href="devguide/index.html">Development Environment Guide</a>. + <a href="http://eclipse.org/ajdt">AJDT (AspectJ Development Tools) + in Eclipse IDE</a>. IntelliJ IDEA also offers AspectJ and Spring AOP + support. <p/> To start using AspectJ with your own code, modify the example aspects to apply to your classes. diff --git a/docs/faq/faq.xml b/docs/faq/faq.xml index e616aae11..2db3b008d 100644 --- a/docs/faq/faq.xml +++ b/docs/faq/faq.xml @@ -54,7 +54,6 @@ a compiler (<literal>ajc</literal>), a debugger (<literal>ajdb</literal>), a documentation generator (<literal>ajdoc</literal>), - a program structure browser (<literal>ajbrowser</literal>), and integration with Eclipse, Sun-ONE/Netbeans, GNU Emacs/XEmacs, JBuilder, and Ant. @@ -2021,16 +2020,7 @@ ajc -bootclasspath c:\jdk1.2\jre\lib\rt.jar \ modularizing crosscutting concerns while still having immediate access to what aspects affect a class. </para> - <para>For example, the - <ulink url="devguide/index.html"> - Development Environment Guide</ulink> - <ulink url="devguide/ajbrowser.html"> - ajbrowser section</ulink>. - shows that you can list or navigate - between method and advice affecting that method and between a type - and declarations in an aspect on that type. (The IDE support may - have more features than <literal>ajbrowser</literal>, depending - on the IDE. + <para> See <xref linkend="q:integrateWithDevTools"/> for more information on which Java development environments are supported.) @@ -4543,15 +4533,11 @@ java -javaagent:aspectjweaver.jar -classpath "aspects.jar:${CLASSPATH}" .. weaver, asm, org.eclipse.jdt.core, org.aspectj.ajdt.core, and runtime. </para></listitem> - <listitem><para>For ajbrowser: the compiler modules, plus - ajbrowser, ajdoc, taskdefs, and ajde. - </para></listitem> <listitem><para>For the AspectJ distribution, the ajbrowser modules, plus aspectj5rt and org.aspectj.lib. </para></listitem> <listitem><para>For the test harness (or to run the release build - scripts and tests): the ajbrowser modules, plus - testing, testing-client, and testing-drivers. + scripts and tests): testing, testing-client, and testing-drivers. </para></listitem> <listitem><para>To run the test suite: the test harness modules, plus tests. @@ -5047,16 +5033,6 @@ cd build </ulink>). </para> <para> - Bug reports on ajbrowser should have version - information for both Java and AspectJ, and - (most importantly) clear steps for reproducing the bug. - You may submit ajbrowser bugs against the IDE component of AspectJ - via the web form - <ulink url="http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ"> - http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ - </ulink>. - </para> - <para> One of the benefits of open-source is that you can find and fix the bug for yourself; when you submit the fix back to us, we can validate the fix for you diff --git a/docs/pom.xml b/docs/pom.xml index c2a8d2f18..39a7c0f7f 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>docs</artifactId> diff --git a/installer/pom.xml b/installer/pom.xml index 9ae8957bb..499c48f16 100644 --- a/installer/pom.xml +++ b/installer/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>installer</artifactId> diff --git a/lib/aspectj/lib/aspectjrt.jar b/lib/aspectj/lib/aspectjrt.jar Binary files differindex 935830ebc..d319bb18c 100644 --- a/lib/aspectj/lib/aspectjrt.jar +++ b/lib/aspectj/lib/aspectjrt.jar diff --git a/lib/aspectj/lib/aspectjtools.jar b/lib/aspectj/lib/aspectjtools.jar Binary files differindex e4efdaf34..130539fd4 100644 --- a/lib/aspectj/lib/aspectjtools.jar +++ b/lib/aspectj/lib/aspectjtools.jar diff --git a/lib/aspectj/lib/aspectjweaver.jar b/lib/aspectj/lib/aspectjweaver.jar Binary files differnew file mode 100644 index 000000000..e1f1fdfa8 --- /dev/null +++ b/lib/aspectj/lib/aspectjweaver.jar diff --git a/lib/pom.xml b/lib/pom.xml index 49d9103e9..712df9905 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>lib</artifactId> @@ -184,7 +184,6 @@ <artifactItems> <artifactItem> - <!-- Available from GitHub Packages (needs special repository declaration) --> <groupId>org.aspectj</groupId> <artifactId>org.eclipse.jdt.core</artifactId> <version>${jdt.core.version}</version> @@ -194,7 +193,6 @@ <destFileName>jdtcore-for-aspectj.jar</destFileName> </artifactItem> <artifactItem> - <!-- Available from GitHub Packages (needs special repository declaration) --> <groupId>org.aspectj</groupId> <artifactId>org.eclipse.jdt.core</artifactId> <version>${jdt.core.version}</version> diff --git a/lib/test/aspectjrt.jar b/lib/test/aspectjrt.jar Binary files differindex fe29ee5e6..d319bb18c 100644 --- a/lib/test/aspectjrt.jar +++ b/lib/test/aspectjrt.jar diff --git a/loadtime/pom.xml b/loadtime/pom.xml index 73897a9fd..c940bab30 100644 --- a/loadtime/pom.xml +++ b/loadtime/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>loadtime</artifactId> diff --git a/org.aspectj.ajdt.core/pom.xml b/org.aspectj.ajdt.core/pom.xml index 0aa31ae4a..37b5fb181 100644 --- a/org.aspectj.ajdt.core/pom.xml +++ b/org.aspectj.ajdt.core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>org.aspectj.ajdt.core</artifactId> diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index d8d1350d7..84569d4df 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -1045,6 +1045,13 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour classpaths[i] = cps.get(i); } FileSystem fileSystem = getLibraryAccess(classpaths, filenames); + + // Use upstream method to generate '--add-reads', '--add-exports' info and copy it into our FileSystem instance. + // See https://github.com/eclipse/org.aspectj/issues/145. + FileSystem fileSystemTemp = buildConfig.getBuildArgParser().getLibraryAccess(); + fileSystem.moduleUpdates = fileSystemTemp.moduleUpdates; + fileSystemTemp.cleanup(); + environment = new StatefulNameEnvironment(fileSystem, state.getClassNameToFileMap(), state); state.setFileSystem(fileSystem); state.setNameEnvironment(environment); @@ -1321,7 +1328,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour */ private String checkRtJar(AjBuildConfig buildConfig) { // omitting dev info - if (Version.getText().equals(Version.DEVELOPMENT) || Version.getText().endsWith("BUILD-SNAPSHOT")) { + if (Version.getText().equals(Version.DEVELOPMENT) || Version.getText().endsWith("-SNAPSHOT")) { // in the development version we can't do this test usefully // MessageUtil.info(holder, "running development version of aspectj compiler"); return null; @@ -1359,7 +1366,7 @@ public class AjBuildManager implements IOutputClassFileNameProvider, IBinarySour } } // assume that users of development aspectjrt.jar know what they're doing - if (version != null && (Version.DEVELOPMENT.equals(version) || version.endsWith("BUILD-SNAPSHOT"))) { + if (version != null && (Version.DEVELOPMENT.equals(version) || version.endsWith("-SNAPSHOT"))) { // MessageUtil.info(holder, // "running with development version of aspectjrt.jar in " + // p.getAbsolutePath()); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java index 0af411be3..dad61e7b2 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/core/builder/StatefulNameEnvironment.java @@ -27,6 +27,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFormatExcepti import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IModule; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; +import org.aspectj.org.eclipse.jdt.internal.compiler.env.IUpdatableModule; import org.aspectj.org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; import org.aspectj.util.FileUtil; @@ -152,6 +153,16 @@ public class StatefulNameEnvironment implements IModuleAwareNameEnvironment { } @Override + public void applyModuleUpdates(IUpdatableModule module, IUpdatableModule.UpdateKind kind) { + baseEnvironment.applyModuleUpdates(module, kind); + } + + @Override + public char[][] getUniqueModulesDeclaringPackage(char[][] packageName, char[] moduleName) { + return baseEnvironment.getUniqueModulesDeclaringPackage(packageName, moduleName); + } + + @Override public char[][] getAllAutomaticModules() { return baseEnvironment.getAllAutomaticModules(); } diff --git a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties index a54d7ec22..23bd98c02 100644 --- a/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties +++ b/org.aspectj.ajdt.core/src/main/resources/org/aspectj/org/eclipse/jdt/internal/compiler/batch/messages_aspectj.properties @@ -1,5 +1,5 @@ compiler.name = AspectJ Compiler -compiler.version = Eclipse Compiler f8768b6899a6a2 (15Sep2021) - Java17 +compiler.version = Eclipse Compiler d3a80f1f9b2f8a (21Mar2022) - Java18 compiler.copyright = misc.version = {0} {1} - {2} {3} diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java index ee49dc10a..a256f6d90 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/Ajc.java @@ -36,6 +36,10 @@ import org.aspectj.bridge.context.CompilationAndWeavingContext; import org.aspectj.testing.util.TestUtil; import org.aspectj.util.FileUtil; +import static java.io.File.pathSeparator; +import static java.io.File.separator; +import static org.aspectj.tools.ajc.AjcTestCase.CLASSPATH_JUNIT; + /** * The Ajc class is intended for use as part of a unit-test suite, it drives the AspectJ compiler and lets you check the compilation * results. Compilations run in a sandbox that is created in C:\temp\ajcSandbox or /tmp/ajcSandbox depending on your platform. @@ -51,13 +55,13 @@ public class Ajc { private static final String BUILD_OUTPUT_FOLDER = "target"; public static final String outputFolder(String module) { - return File.pathSeparator + ".." +File.separator + module + File.separator + BUILD_OUTPUT_FOLDER + File.separator + "classes"; + return pathSeparator + ".." + separator + module + separator + BUILD_OUTPUT_FOLDER + separator + "classes"; } public static final String outputFolders(String... modules) { StringBuilder s = new StringBuilder(); for (String module: modules) { - s.append(File.pathSeparator + ".." +File.separator + module + File.separator + BUILD_OUTPUT_FOLDER + File.separator + "classes"); + s.append(pathSeparator + ".." + separator + module + separator + BUILD_OUTPUT_FOLDER + separator + "classes"); } return s.toString(); } @@ -67,7 +71,7 @@ public class Ajc { outputFolder("testing-client") + outputFolder("runtime") + outputFolder("bcel-builder") - + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "junit" + File.separator + "junit.jar" + + pathSeparator + CLASSPATH_JUNIT + outputFolder("bridge") + outputFolder("loadtime") + outputFolder("weaver") @@ -321,17 +325,17 @@ public class Ajc { hasOutdir = true; } boolean isOutjar = args[i].equals("-outjar"); - StringTokenizer strTok = new StringTokenizer(args[++i], File.pathSeparator); + StringTokenizer strTok = new StringTokenizer(args[++i], pathSeparator); while (strTok.hasMoreTokens()) { File f = new File(strTok.nextToken()); buff.append(adjustFileOrDir(f, copyThisTime, isOutjar).getAbsolutePath()); if (strTok.hasMoreTokens()) - buff.append(File.pathSeparator); + buff.append(pathSeparator); } newArgs[i] = buff.toString(); if (args[i - 1].equals("-classpath")) { hasClasspath = true; - newArgs[i] = newArgs[i] + File.pathSeparator + TESTER_PATH + File.pathSeparator + newArgs[i] = newArgs[i] + pathSeparator + TESTER_PATH + pathSeparator + getSandboxDirectory().getAbsolutePath(); } } else { @@ -348,7 +352,7 @@ public class Ajc { newArgs = new String[oldArgs.length + 2]; System.arraycopy(oldArgs, 0, newArgs, 0, oldArgs.length); newArgs[oldArgs.length] = "-classpath"; - newArgs[oldArgs.length + 1] = TESTER_PATH + File.pathSeparator + getSandboxDirectory().getAbsolutePath(); + newArgs[oldArgs.length + 1] = TESTER_PATH + pathSeparator + getSandboxDirectory().getAbsolutePath(); } if (!hasOutdir) { String[] oldArgs = newArgs; @@ -366,7 +370,7 @@ public class Ajc { if (!from.isAbsolute()) { ret = new File(sandbox, from.getPath()); File fromParent = from.getParentFile(); - String relativeToPath = (fromParent != null) ? (fromParent.getPath() + File.separator) : ""; + String relativeToPath = (fromParent != null) ? (fromParent.getPath() + separator) : ""; if (baseDir != null) { from = new File(baseDir, from.getPath()); // if (ensureDirsExist) { diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 0bf08886c..e50ea9757 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java @@ -29,6 +29,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; +import java.util.stream.Collectors; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; @@ -37,6 +38,9 @@ import org.aspectj.util.LangUtil; import junit.framework.TestCase; +import static java.io.File.pathSeparator; +import static java.io.File.separator; + /** * A TestCase class that acts as the superclass for all test cases wishing to drive the ajc compiler. * <p> @@ -65,22 +69,42 @@ public abstract class AjcTestCase extends TestCase { public static final String CLASSPATH_ASM = Arrays.stream(System.getProperty("java.class.path") - .split(File.pathSeparator)) + .split(pathSeparator)) .filter(path -> path.replace('\\', '/').contains("org/ow2/asm/")) .findFirst() .orElseThrow(() -> new RuntimeException("ASM library not found on classpath")); + public static final String CLASSPATH_JDT_CORE = + Arrays.stream(System.getProperty("java.class.path") + .split(pathSeparator)) + .filter(path -> path.replace('\\', '/').contains("/org/aspectj/org.eclipse.jdt.core/")) + .findFirst() + .orElseThrow(() -> new RuntimeException("AspectJ JDT Core library not found on classpath")); + public static final String CLASSPATH_JUNIT = + Arrays.stream(System.getProperty("java.class.path") + .split(pathSeparator)) + .filter(path -> path.replace('\\', '/').contains("/junit/junit/")) + .findFirst() + .orElseThrow(() -> new RuntimeException("JUnit library not found on classpath")); + + // In 'useFullLTW' mode, aspectjweaver.jar is a Java agent. Therefore, what is contained in there + // does not need to be on the classpath. + public static final String DEFAULT_FULL_LTW_CLASSPATH_ENTRIES = + Ajc.outputFolders("testing-client") + + pathSeparator + CLASSPATH_JUNIT + + pathSeparator + ".." + separator + "lib" + separator + "test" + separator + "testing-client.jar" + ; - // see Ajc and AntSpec + // See Ajc and AntSpec public static final String DEFAULT_CLASSPATH_ENTRIES = - Ajc.outputFolders("bridge","util","loadtime","weaver","asm","testing-client","runtime","org.aspectj.matcher") - + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "junit" + File.separator + "junit.jar" - + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator + "bcel.jar" - + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "bcel" + File.separator + "bcel-verifier.jar" - + File.pathSeparator + CLASSPATH_ASM - + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test" + File.separator + "testing-client.jar" - // hmmm, this next one should perhaps point to an aj-build jar... - + File.pathSeparator + ".." + File.separator + "lib" + File.separator + "test" + File.separator + "aspectjrt.jar" - ; + DEFAULT_FULL_LTW_CLASSPATH_ENTRIES + + Ajc.outputFolders("bridge", "util", "loadtime", "weaver", "asm", "runtime", "org.aspectj.matcher", "bcel-builder") + + pathSeparator + ".." + separator + "lib" + separator + "bcel" + separator + "bcel.jar" + + pathSeparator + ".." + separator + "lib" + separator + "bcel" + separator + "bcel-verifier.jar" + + pathSeparator + CLASSPATH_JDT_CORE + + pathSeparator + CLASSPATH_ASM + // hmmm, this next one should perhaps point to an aj-build jar... + + pathSeparator + ".." + separator + "lib" + separator + "test" + separator + "aspectjrt.jar" + ; /* * Save reference to real stderr and stdout before starting redirection @@ -149,7 +173,7 @@ public abstract class AjcTestCase extends TestCase { char[] chars = srcFile.toCharArray(); for (char c : chars) { if ((c == '\\') || (c == '/')) { - srcFileName.append(File.separator); + srcFileName.append(separator); } else { srcFileName.append(c); } @@ -232,29 +256,16 @@ public abstract class AjcTestCase extends TestCase { public String toString() { StringBuilder buff = new StringBuilder(); buff.append("message "); - if (sourceFileName != null) { - buff.append("in file "); - buff.append(sourceFileName); - buff.append(" "); - } - if (line != -1) { - buff.append("on line "); - buff.append(line); - buff.append(" "); - } - if (text != null) { - buff.append("containing text '"); - buff.append(text); - buff.append("' "); - } + if (sourceFileName != null) + buff.append("in file ").append(sourceFileName).append(" "); + if (line != -1) + buff.append("on line ").append(line).append(" "); + if (text != null) + buff.append("containing text '").append(text).append("' "); if (seeAlsos != null) { buff.append("\n\twith see alsos:"); - for (ISourceLocation seeAlso : seeAlsos) { - buff.append("\t\t"); - buff.append(seeAlso.getSourceFile().getPath()); - buff.append(":"); - buff.append(seeAlso.getLine()); - } + for (ISourceLocation seeAlso : seeAlsos) + buff.append("\t\t").append(seeAlso.getSourceFile().getPath()).append(":").append(seeAlso.getLine()); } return buff.toString(); } @@ -459,12 +470,10 @@ public abstract class AjcTestCase extends TestCase { addExtra(failureReport, "error", extraErrors); addExtra(failureReport, "fail", extraFails); addExtra(failureReport, "weaveInfo", extraWeaves); - failureReport.append("\ncommand was: 'ajc"); + failureReport.append("\nCommand: 'ajc"); String[] args = result.getArgs(); - for (String arg : args) { - failureReport.append(" "); - failureReport.append(arg); - } + for (String arg : args) + failureReport.append(" ").append(arg); String report = failureReport.toString(); System.err.println(failureReport); fail(assertionFailedMessage + "'\n" + report); @@ -570,17 +579,16 @@ public abstract class AjcTestCase extends TestCase { */ public RunResult run(String className, String moduleName, String[] args, String vmargs, final String classpath, String modulepath, boolean useLTW, boolean useFullLTW) { - if (args != null) { - for (int i = 0; i < args.length; i++) { - args[i] = substituteSandbox(args[i]); - } - } + if (args == null) + args = new String[0]; + for (int i = 0; i < args.length; i++) + args[i] = substituteSandbox(args[i]); + lastRunResult = null; StringBuilder cp = new StringBuilder(); if (classpath != null) { // allow replacing this special variable, rather than copying all files to allow tests of jars that don't end in .jar - cp.append(substituteSandbox(classpath)); - cp.append(File.pathSeparator); + cp.append(substituteSandbox(classpath)).append(pathSeparator); } if (moduleName == null) { // When running modules, we want more control so don't try to be helpful by adding all jars @@ -588,10 +596,8 @@ public abstract class AjcTestCase extends TestCase { getAnyJars(ajc.getSandboxDirectory(), cp); } StringBuilder mp = new StringBuilder(); - if (modulepath != null) { - mp.append(substituteSandbox(modulepath)); - mp.append(File.pathSeparator); - } + if (modulepath != null) + mp.append(substituteSandbox(modulepath)).append(pathSeparator); URLClassLoader sandboxLoader; ClassLoader parentLoader = getClass().getClassLoader().getParent(); @@ -613,17 +619,26 @@ public abstract class AjcTestCase extends TestCase { URL[] sandboxUrls = getURLs(cp.toString()); sandboxLoader = createWeavingClassLoader(sandboxUrls, aspectjLoader); // sandboxLoader = createWeavingClassLoader(sandboxUrls,testLoader); - } else if(useFullLTW && useLTW) { + } + else if(useFullLTW && useLTW) { if(vmargs == null){ vmargs =""; } File directory = new File ("."); String absPath = directory.getAbsolutePath(); - String javaagent= absPath+File.separator+".."+File.separator+"aj-build"+File.separator+"dist"+File.separator+"tools"+File.separator+"lib"+File.separator+"aspectjweaver.jar"; + String javaagent = absPath + separator + ".." + separator + "lib" + separator + "aspectj" + separator + "lib" + separator + "aspectjweaver.jar"; + String defaultCpAbsolute = Arrays.stream(DEFAULT_FULL_LTW_CLASSPATH_ENTRIES.split(pathSeparator)) + .map(path -> new File(path).getAbsolutePath()) + .collect(Collectors.joining(pathSeparator)); try { - String command ="java " +vmargs+ " -classpath " + cp +" -javaagent:"+javaagent + " " + className ; - + String command = + "java " + vmargs + + " -classpath " + cp + pathSeparator + defaultCpAbsolute + + " -javaagent:" + javaagent + " " + + className + " " + String.join(" ", args); + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); // Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command)); pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath())); @@ -637,7 +652,8 @@ public abstract class AjcTestCase extends TestCase { e.printStackTrace(); } return lastRunResult; - } else if (moduleName != null) { + } + else if (moduleName != null) { // CODE FOR RUNNING MODULES if(vmargs == null){ vmargs =""; @@ -649,13 +665,11 @@ public abstract class AjcTestCase extends TestCase { if (mp.indexOf("$runtime") != -1) { mp = mp.replace(mp.indexOf("$runtime"),"$runtime".length(),TestUtil.aspectjrtPath().toString()); } - if (cp.indexOf("aspectjrt")==-1) { - cp.append(TestUtil.aspectjrtPath().getPath()).append(File.pathSeparator); - } - String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " -p "+mp+" --module "+moduleName ; - if (Ajc.verbose) { - System.out.println("Command is "+command); - } + if (cp.indexOf("aspectjrt") == -1) + cp.append(TestUtil.aspectjrtPath().getPath()).append(pathSeparator); + String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " + vmargs + (cp.length() == 0 ? "" : " -classpath " + cp) + " -p " + mp + " --module " + moduleName; + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); // Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command)); pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath())); @@ -669,19 +683,27 @@ public abstract class AjcTestCase extends TestCase { e.printStackTrace(); } return lastRunResult; - } else if (vmargs!=null && (vmargs.contains("--enable-preview") || vmargs.contains("--add-modules") || vmargs.contains("--limit-modules") || vmargs.contains("--add-reads"))) { + } + else if ( + vmargs != null && ( + vmargs.contains("--enable-preview") || + vmargs.contains("--add-modules") || + vmargs.contains("--limit-modules") || + vmargs.contains("--add-reads") || + vmargs.contains("--add-exports") + ) + ) { // If --add-modules supplied, need to fork the test try { // if (mp.indexOf("$runtime") != -1) { // mp = mp.replace(mp.indexOf("$runtime"),"$runtime".length(),TestUtil.aspectjrtPath().toString()); // } if (cp.indexOf("aspectjrt")==-1) { - cp.append(File.pathSeparator).append(TestUtil.aspectjrtPath().getPath()); + cp.append(pathSeparator).append(TestUtil.aspectjrtPath().getPath()); } String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " " + className ; - if (Ajc.verbose) { - System.out.println("\nCommand is "+command); - } + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); // Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command)); pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath())); @@ -695,7 +717,8 @@ public abstract class AjcTestCase extends TestCase { e.printStackTrace(); } return lastRunResult; - } else { + } + else { cp.append(DEFAULT_CLASSPATH_ENTRIES); URL[] urls = getURLs(cp.toString()); sandboxLoader = new URLClassLoader(urls, parentLoader); @@ -703,16 +726,13 @@ public abstract class AjcTestCase extends TestCase { ByteArrayOutputStream baosOut = new ByteArrayOutputStream(); ByteArrayOutputStream baosErr = new ByteArrayOutputStream(); - StringBuilder command = new StringBuilder(); - command.append("java -classpath "); - command.append(cp.toString()); - command.append(" "); - command.append(className); - for (String arg : args) { - command.append(" "); - command.append(arg); - } + command.append("java -classpath ").append(cp).append(" ").append(className); + for (String arg : args) + command.append(" ").append(arg); + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); + // try { // // Enable the security manager // Policy.setPolicy(new MyPolicy()); @@ -867,7 +887,7 @@ public abstract class AjcTestCase extends TestCase { } private URL[] getURLs(String classpath) { - StringTokenizer strTok = new StringTokenizer(classpath, File.pathSeparator); + StringTokenizer strTok = new StringTokenizer(classpath, pathSeparator); URL[] urls = new URL[strTok.countTokens()]; try { for (int i = 0; i < urls.length; i++) { @@ -926,7 +946,7 @@ public abstract class AjcTestCase extends TestCase { cpIndex++; String[] newargs = new String[args.length]; System.arraycopy(args, 0, newargs, 0, args.length); - newargs[cpIndex] = args[cpIndex] + File.pathSeparator + TestUtil.aspectjrtPath().getPath(); + newargs[cpIndex] = args[cpIndex] + pathSeparator + TestUtil.aspectjrtPath().getPath(); args = newargs; } } @@ -934,7 +954,7 @@ public abstract class AjcTestCase extends TestCase { if (needsJRTFS) { if (!args[cpIndex].contains(LangUtil.JRT_FS)) { String jrtfsPath = LangUtil.getJrtFsFilePath(); - args[cpIndex] = jrtfsPath + File.pathSeparator + args[cpIndex]; + args[cpIndex] = jrtfsPath + pathSeparator + args[cpIndex]; } } return args; @@ -985,27 +1005,17 @@ public abstract class AjcTestCase extends TestCase { private void addMissing(StringBuilder buff, String type, List<AjcTestCase.Message> messages) { if (!messages.isEmpty()) { - buff.append("Missing expected "); - buff.append(type); - buff.append(" messages:\n"); - for (Message message : messages) { - buff.append("\t"); - buff.append(message.toString()); - buff.append("\n"); - } + buff.append("Missing expected ").append(type).append(" messages:\n"); + for (Message message : messages) + buff.append("\t").append(message.toString()).append("\n"); } } private void addExtra(StringBuilder buff, String type, List messages) { if (!messages.isEmpty()) { - buff.append("Unexpected "); - buff.append(type); - buff.append(" messages:\n"); - for (Object message : messages) { - buff.append("\t"); - buff.append(message.toString()); - buff.append("\n"); - } + buff.append("Unexpected ").append(type).append(" messages:\n"); + for (Object message : messages) + buff.append("\t").append(message.toString()).append("\n"); } } @@ -1013,12 +1023,10 @@ public abstract class AjcTestCase extends TestCase { private void getAnyJars(File dir, StringBuilder buff) { File[] files = dir.listFiles(); for (File file : files) { - if (file.getName().endsWith(".jar")) { - buff.append(File.pathSeparator); - buff.append(file.getAbsolutePath()); - } else if (file.isDirectory()) { + if (file.getName().endsWith(".jar")) + buff.append(pathSeparator).append(file.getAbsolutePath()); + else if (file.isDirectory()) getAnyJars(file, buff); - } } } diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java index 612f16539..f2757bdaa 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java @@ -212,7 +212,7 @@ public class CompilationResult { buff.append(weaveMessage.toString()); buff.append("\n"); } - buff.append("\ncommand was: 'ajc"); + buff.append("\nCommand: 'ajc"); for (String arg : args) { buff.append(' '); buff.append(arg); diff --git a/org.aspectj.lib/.classpath b/org.aspectj.lib/.classpath deleted file mode 100644 index 360c2743a..000000000 --- a/org.aspectj.lib/.classpath +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/> - <classpathentry kind="src" path="testsrc"/> - <classpathentry sourcepath="/lib/junit/junit-src.jar" kind="lib" path="/lib/junit/junit.jar"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/org.aspectj.lib/build-aspectjlib.xml b/org.aspectj.lib/build-aspectjlib.xml deleted file mode 100644 index a35d448f3..000000000 --- a/org.aspectj.lib/build-aspectjlib.xml +++ /dev/null @@ -1,158 +0,0 @@ -<!-- wrapped at 70 characters, long elements wrapped --> -<!-- =========================================================================== - - Copyright (c) 2005 Contributors. - All rights reserved. - This program and the accompanying materials are made available - under the terms of the Eclipse Public License v 2.0 - which accompanies this distribution and is available at - https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - - Contributors: - Wes Isberg initial implementation - -============================================================================ --> - -<project name="aspectj-library" default="aspectjlib" basedir="."> - - <target name="aspectjlib" depends="compile" /> - <target name="info"> - <echo> - This script builds the AspectJ library. - - Relevant targets: - aspectjlib build library - - Setup: - - Run from the doc/aspectjlib directory in your AspectJ distribution. - The tasks in ../../lib/aspectjtools.jar are used automatically. - - Variants: - - To define a variable, use the Ant -D option - e.g., on Windows: - - ant -f build.xml -DJAVA_HOME=c:\jdk1.3.1 -Dnorun=skip - - </echo> - </target> - - - <!-- ============================================================= --> - <!-- setup and cleanup targets --> - <!-- ============================================================= --> - - <target name="clean" - depends="init" - description="clean and create classes/jar dir, .ajesym files" - > - <delete quiet="on" dir="${jar.dir}" /> - <delete quiet="on"> - <fileset dir="${org.aspectj.lib.dir}" - includes="**/*.ajesym" - /> - </delete> - <mkdir dir="${jar.dir}" /> - </target> - - <target name="init" depends="init.variables,init.taskdefs" /> - - <target name="init.variables" description="init variables"> - - <property name="org.aspectj.lib.dir" location="${basedir}" /> - <property name="src.dir" - location="${org.aspectj.lib.dir}/src" - /> - - <!-- find AspectJ lib dir in distribution or AspectJ CVS tree --> - <property name="aspectj.dist.lib" - location="${basedir}/../../lib" - /> - - <property name="aspectj.tree.lib" - location="${basedir}/../lib/aspectj/lib" - /> - - <condition property="aspectj.lib.dir" - value="${aspectj.dist.lib}" - > - <available file="${aspectj.dist.lib}/aspectjtools.jar" /> - </condition> - - <condition property="aspectj.lib.dir" - value="${aspectj.tree.lib}" - > - <available file="${aspectj.tree.lib}/aspectjtools.jar" /> - </condition> - - <property name="aspectjrt.jar" - location="${aspectj.lib.dir}/aspectjrt.jar" - /> - <property name="aspectjtools.jar" - location="${aspectj.lib.dir}/aspectjtools.jar" - /> - <property name="aspectjweaver.jar" - location="${aspectj.lib.dir}/aspectjweaver.jar" - /> - - <property name="jar.dir" - location="${org.aspectj.lib.dir}/jars" - /> - <property name="aspectjlib.out.jar" - location="${jar.dir}/aspectjlib.out.jar" - /> - - <available file="${aspectjtools.jar}" - property="aspectjtools.jar.available" - /> - <available file="${aspectjrt.jar}" - property="aspectjrt.jar.available" - /> - - <property name="library.packages" value="org.aspectj.lib" /> - </target> - - <target name="init.taskdefs" - depends="init.variables, - aspectjtools.jar.available, - aspectjrt.jar.available" - unless="taskdefs.init" - > - <taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties" - > - <classpath> - <pathelement path="${aspectjtools.jar}" /> - </classpath> - </taskdef> - <property name="taskdefs.init" value="true" /> - </target> - - <target name="aspectjrt.jar.available" - depends="init.variables" - unless="aspectjrt.jar.available" - > - <fail message="expecting aspectjrt.jar at ${aspectjrt.jar}" /> - </target> - - <target name="aspectjtools.jar.available" - depends="init.variables" - unless="aspectjtools.jar.available" - > - <fail message="expecting aspectjtools.jar at ${aspectjtools.jar}" - /> - </target> - - <target name="compile" - depends="init" - description="compile library" - > - <antcall target="clean" /> - <!-- can use ajc or iajc here --> - <iajc sourceroots="${src.dir}" - fork="true" - forkclasspath="${aspectjtools.jar}" - classpath="${aspectjrt.jar}" - outjar="${aspectjlib.out.jar}" - /> - - </target> - -</project> diff --git a/org.aspectj.lib/build.ajproperties b/org.aspectj.lib/build.ajproperties deleted file mode 100644 index dc76e27a4..000000000 --- a/org.aspectj.lib/build.ajproperties +++ /dev/null @@ -1,2 +0,0 @@ -src.includes = src/,\ - testsrc/ diff --git a/org.aspectj.lib/org.aspectj.lib.mf.txt b/org.aspectj.lib/org.aspectj.lib.mf.txt deleted file mode 100644 index 3cc8400e9..000000000 --- a/org.aspectj.lib/org.aspectj.lib.mf.txt +++ /dev/null @@ -1,18 +0,0 @@ -Manifest-Version: 1.0 - -Name: org/aspectj/lib/ -Specification-Title: AspectJ Library Classes -Specification-Version: @build.version.base@ -Specification-Vendor: @company.name@ -Implementation-Title: org.aspectj.lib -Implementation-Version: @build.version@ -Implementation-Vendor: @company.name@ -Bundle-Name: AspectJ -Bundle-Version: @build.version.base@ -Import-Package: org.aspectj.lib,org.aspectj.lib.pointcuts -Bundle-Copyright: (C) Copyright 2005 Contributors. - All Rights Reserved. - - - - diff --git a/org.aspectj.lib/pom.xml b/org.aspectj.lib/pom.xml deleted file mode 100644 index 72d61766d..000000000 --- a/org.aspectj.lib/pom.xml +++ /dev/null @@ -1,23 +0,0 @@ -<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.4</version> - </parent> - - <artifactId>runtime</artifactId> - - <dependencies> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>testing-util</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - -</project> diff --git a/org.aspectj.lib/readme-org.aspectj.lib.html b/org.aspectj.lib/readme-org.aspectj.lib.html deleted file mode 100644 index 8e269623b..000000000 --- a/org.aspectj.lib/readme-org.aspectj.lib.html +++ /dev/null @@ -1,58 +0,0 @@ -<html> - <head><title>org.aspectj.lib library module</title></head> - <body> -<h2>org.aspectj.lib library module</h2> -<p> -This module has source for both <code>{AspectJ}/lib/aspectjlib.jar</code> -and <code>{AspectJ}/docs/aspectjlib/*</code>. -</p> - -<h3>Building {AspectJ}/lib/aspectjlib.jar</h3> -<p> -This module is compiled using AspectJ, both in Eclipse and with Ant. -The Eclipse support is defined as usual in -<a href=".classpath">.classpath</a> and <a href=".project">.project</a>. -The Ant build support in <a href="../build/build.xml">../build/build.xml</a> -is limited: -</p> -<ul> - <li>This module is built and published as - <code>{aspectj}/lib/aspectjlib.jar</code>. - This happens automatically, with no explicit Ant script. - The <a href="../build/src/org/aspectj/internal/tools/build/Builder.java"> - Builder.java</a> - task uses <code>moduleAliasFor(String)</code> to map from the name of - the empty file - <a href="../build/products/tools/dist/lib/aspectjlib.jar"> - ../build/products/tools/dist/lib/aspectjlib.jar</a> - back to the module output - <a href="../aj-build/jars/org.aspectj.lib.jar"> - ../aj-build/jars/org.aspectj.lib.jar</a>.</li> - <li>The AspectJ support compiles only source files in <a href="src/">src/</a></li> - <li>It does not use inpath, aspectpath, or any other aspectj-specific - option</li> - <li>All non-Java (resource) files in the source directory will be included - in the library.</li> - <li>There should be no dependencies. Any libraries or modules on - the Java classpath would be included in the shipped library.</li> - <li>This is built using the release of AspectJ in - <a href="../lib/aspectj">../lib/aspectj</a>.</li> -</ul> -<h3>Building {AspectJ}/examples/aspectjlib/*</h3> -<p> -The docs build script <a href="../docs/build.xml">../docs/build.xml</a> -is responsible for assembling sources from this directory into the docs -directory. It relies on the name of the source directory and build script. -Also, <code>Builder.java</code> is designed to try to use any -<code>build.xml</code> to build the module, but Ant builds are now disabled. -So if you change the build script name or the source directory names, update -the docs build script and the builder as needed. -</p> -<p> -The <a href="build-aspectjlib.xml">build-aspectjlib.xml</a> script looks for -an AspectJ lib directory from either the distribution (aspectj/docs/aspectjlib) -or from the CVS tree (modules/org.aspectj.lib), so the script can be tested -in situ. -</p> -</body> -</html>
\ No newline at end of file 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 deleted file mode 100644 index 1c69912a5..000000000 --- a/org.aspectj.lib/src/main/java/org/aspectj/lib/pointcuts/Pointcuts.java +++ /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 Eclipse Public License v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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 deleted file mode 100644 index a2cf4ffd3..000000000 --- a/org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPoints.java +++ /dev/null @@ -1,141 +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 v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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 - 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 deleted file mode 100644 index 3a9630d8a..000000000 --- a/org.aspectj.lib/src/main/java/org/aspectj/lib/tracing/TraceJoinPointsBase.java +++ /dev/null @@ -1,69 +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 v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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 - 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 deleted file mode 100644 index 0f03a7683..000000000 --- a/org.aspectj.lib/src/test/java/org/aspectj/lib/LibModuleTests.java +++ /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 v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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 deleted file mode 100644 index ebc441f97..000000000 --- a/org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTest.java +++ /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 v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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 deleted file mode 100644 index 59a86fc33..000000000 --- a/org.aspectj.lib/src/test/java/org/aspectj/lib/pointcuts/PointcutsTests.java +++ /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 v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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 deleted file mode 100644 index fa4539255..000000000 --- a/org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TraceJoinPointsTest.java +++ /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 v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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 deleted file mode 100644 index b94109783..000000000 --- a/org.aspectj.lib/src/test/java/org/aspectj/lib/tracing/TracingTests.java +++ /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 v 2.0 - * which accompanies this distribution and is available at - * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt - * - * 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.matcher/pom.xml b/org.aspectj.matcher/pom.xml index 9be544784..bc4ac7896 100644 --- a/org.aspectj.matcher/pom.xml +++ b/org.aspectj.matcher/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>org.aspectj.matcher</artifactId> @@ -5,7 +5,7 @@ <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> <packaging>pom</packaging> <name>AspectJ Parent Project</name> @@ -21,7 +21,7 @@ <maven.javadoc.skip>true</maven.javadoc.skip> <!-- Dependency versions --> - <jdt.core.version>1.9.9-SNAPSHOT</jdt.core.version> + <jdt.core.version>1.9.9.1</jdt.core.version> <asm.version>9.2</asm.version> <lib.ant.version>1.6.3</lib.ant.version> <lib.ant.xerces.version>2.6.2</lib.ant.xerces.version> @@ -81,20 +81,6 @@ <updatePolicy>never</updatePolicy> </releases> </repository> - <repository> - <id>aspectj-dev</id> - <name>AspectJ artifacts on aspectj.dev</name> - <url>https://aspectj.dev/maven</url> - <layout>default</layout> - <snapshots> - <enabled>true</enabled> - <updatePolicy>always</updatePolicy> - </snapshots> - <releases> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - </releases> - </repository> </repositories> <pluginRepositories> @@ -131,20 +117,6 @@ <updatePolicy>never</updatePolicy> </releases> </pluginRepository> - <pluginRepository> - <id>aspectj-dev</id> - <name>AspectJ artifacts on aspectj.dev</name> - <url>https://aspectj.dev/maven</url> - <layout>default</layout> - <snapshots> - <enabled>true</enabled> - <updatePolicy>always</updatePolicy> - </snapshots> - <releases> - <enabled>true</enabled> - <updatePolicy>never</updatePolicy> - </releases> - </pluginRepository> </pluginRepositories> <modules> @@ -155,7 +127,6 @@ <module>org.aspectj.matcher</module> <module>asm</module> <module>testing-client</module> - <module>ajbrowser</module> <module>runtime</module> <module>bcel-builder</module> <module>weaver</module> @@ -196,6 +167,7 @@ </activation> <properties> <jvm.arg.addOpens/> + <jvm.arg.allowSecurityManager/> </properties> </profile> <profile> @@ -205,6 +177,21 @@ </activation> <properties> <jvm.arg.addOpens>--add-opens java.base/java.lang=ALL-UNNAMED</jvm.arg.addOpens> + <jvm.arg.allowSecurityManager/> + </properties> + </profile> + <profile> + <id>jdk-18-to-xx</id> + <activation> + <jdk>[18,)</jdk> + </activation> + <properties> + <!-- + JEP 411: Deprecate the Security Manager for Removal, see https://openjdk.java.net/jeps/411. + As of Java 18, the new API for blocking System.exit is not available yet, see + https://bugs.openjdk.java.net/browse/JDK-8199704. + --> + <jvm.arg.allowSecurityManager>-Djava.security.manager=allow</jvm.arg.allowSecurityManager> </properties> </profile> <profile> @@ -254,7 +241,10 @@ <version>2.22.2</version> <configuration> <!--<testFailureIgnore>true</testFailureIgnore>--> - <argLine>${jvm.arg.addOpens}</argLine> + <argLine> + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + </argLine> <excludes> <exclude>**/*ModuleTests.java</exclude> </excludes> @@ -300,13 +290,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> - <!-- - TODO: Replace by release in which - - https://issues.apache.org/jira/browse/MSHADE-252, - - https://issues.apache.org/jira/browse/MSHADE-391, - - https://issues.apache.org/jira/browse/MSHADE-366 are fixed. - --> - <version>3.2.4.MSHADE-252-391</version> + <version>3.3.0</version> <configuration> <createSourcesJar>true</createSourcesJar> <createDependencyReducedPom>false</createDependencyReducedPom> @@ -343,6 +327,10 @@ <artifactId>maven-assembly-plugin</artifactId> <version>3.1.1</version> </plugin> + <!-- + TODO: MSHADE-36 is in Maven Shade 3.3.0 -> it should be possible to include the dependency-reduced POM there + directly. So maybe, we can rid of Flatten Maven Plugin. + --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>flatten-maven-plugin</artifactId> diff --git a/run-all-junit-tests/pom.xml b/run-all-junit-tests/pom.xml index 3e2357312..30df18d38 100644 --- a/run-all-junit-tests/pom.xml +++ b/run-all-junit-tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>run-all-junit-tests</artifactId> @@ -198,7 +198,10 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <testFailureIgnore>true</testFailureIgnore> - <argLine>${jvm.arg.addOpens}</argLine> + <argLine> + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + </argLine> </configuration> <executions> <execution> @@ -253,4 +256,3 @@ </build> </project> - diff --git a/run-all-junit-tests/src/test/java/RunTheseBeforeYouCommitTests.java b/run-all-junit-tests/src/test/java/RunTheseBeforeYouCommitTests.java index a696b71ba..6d77b170f 100644 --- a/run-all-junit-tests/src/test/java/RunTheseBeforeYouCommitTests.java +++ b/run-all-junit-tests/src/test/java/RunTheseBeforeYouCommitTests.java @@ -50,7 +50,6 @@ public class RunTheseBeforeYouCommitTests { suite.addTest(WeaverModuleTests.suite()); suite.addTest(TaskdefsModuleTests.suite()); suite.addTest(MatcherModuleTests.suite()); -// suite.addTest(AjbrowserModuleTests.suite()); // There are none so far... // suite.addTest(LibModuleTests.suite()); // anyone using this? suite.addTest(AjdtCoreModuleTests.suite()); diff --git a/runtime/pom.xml b/runtime/pom.xml index 834943106..e66954933 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>runtime</artifactId> diff --git a/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java b/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java index bb09e6869..851a8b3dc 100644 --- a/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java +++ b/runtime/src/main/java/org/aspectj/runtime/reflect/JoinPointImpl.java @@ -79,6 +79,18 @@ class JoinPointImpl implements ProceedingJoinPoint { } } + static class InheritableThreadLocalAroundClosureStack extends InheritableThreadLocal<Stack<AroundClosure>> { + @Override + protected Stack<AroundClosure> initialValue() { + return new Stack<>(); + } + + @Override + protected Stack<AroundClosure> childValue(Stack<AroundClosure> parentValue) { + return (Stack<AroundClosure>) parentValue.clone(); + } + } + Object _this; Object target; Object[] args; @@ -140,7 +152,7 @@ class JoinPointImpl implements ProceedingJoinPoint { // will either be using arc or arcs but not both. arcs being non-null // indicates it is in use (even if an empty stack) private AroundClosure arc = null; - private Stack<AroundClosure> arcs = null; + private InheritableThreadLocalAroundClosureStack arcs = null; public void set$AroundClosure(AroundClosure arc) { this.arc = arc; @@ -149,12 +161,12 @@ class JoinPointImpl implements ProceedingJoinPoint { public void stack$AroundClosure(AroundClosure arc) { // If input parameter arc is null this is the 'unlink' call from AroundClosure if (arcs == null) { - arcs = new Stack<>(); + arcs = new InheritableThreadLocalAroundClosureStack(); } if (arc==null) { - this.arcs.pop(); + this.arcs.get().pop(); } else { - this.arcs.push(arc); + this.arcs.get().push(arc); } } @@ -167,7 +179,8 @@ class JoinPointImpl implements ProceedingJoinPoint { return arc.run(arc.getState()); } } else { - return arcs.peek().run(arcs.peek().getState()); + final AroundClosure ac = arcs.get().peek(); + return ac.run(ac.getState()); } } @@ -177,7 +190,7 @@ class JoinPointImpl implements ProceedingJoinPoint { if (arcs == null) { ac = arc; } else { - ac = arcs.peek(); + ac = arcs.get().peek(); } if (ac == null) { diff --git a/shadows.org.eclipse.jdt.core/.classpath b/shadows.org.eclipse.jdt.core/.classpath deleted file mode 100644 index 969634614..000000000 --- a/shadows.org.eclipse.jdt.core/.classpath +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path=""/> - <classpathentry kind="output" path=""/> -</classpath> diff --git a/shadows.org.eclipse.jdt.core/.project b/shadows.org.eclipse.jdt.core/.project deleted file mode 100644 index b4aeaa437..000000000 --- a/shadows.org.eclipse.jdt.core/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>shadows.org.eclipse.jdt.core</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/shadows.org.eclipse.jdt.core/README.html b/shadows.org.eclipse.jdt.core/README.html deleted file mode 100644 index 979fd256e..000000000 --- a/shadows.org.eclipse.jdt.core/README.html +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html> - <head> - <title>Placeholder for the Shadow version Eclipse JDT compiler</title> - </head> - - <body> - <h1>Placeholder for the Shadow version of the Eclipse JDT Compiler</h1> - - <p>This module is here so that the org.eclipse.jdt.core project can - fulfill its project dependencies when not working with the 'real' - shadow version of org.eclipse.jdt.core (the normal mode). It contains - a build.xml file that does nothing, in order to satisfy the external - builder tool added to the chain of the org.eclipse.jdt.core HEAD project. - </p> - </body> -</html> diff --git a/shadows.org.eclipse.jdt.core/build.xml b/shadows.org.eclipse.jdt.core/build.xml deleted file mode 100644 index 232cbc7eb..000000000 --- a/shadows.org.eclipse.jdt.core/build.xml +++ /dev/null @@ -1,5 +0,0 @@ -<project name="ShadowJdtCore" basedir="." default="make.jdtcore.jar"> - <target name="make.jdtcore.jar"> - <echo message="dummy build of jdtcore.jar complete."/> - </target> -</project>
\ No newline at end of file diff --git a/shadows.org.eclipse.jdt.core/notamodule b/shadows.org.eclipse.jdt.core/notamodule deleted file mode 100644 index e69de29bb..000000000 --- a/shadows.org.eclipse.jdt.core/notamodule +++ /dev/null diff --git a/shadows.org.eclipse.jdt.core/shadow_folder/shadow_file.txt b/shadows.org.eclipse.jdt.core/shadow_folder/shadow_file.txt deleted file mode 100644 index e69de29bb..000000000 --- a/shadows.org.eclipse.jdt.core/shadow_folder/shadow_file.txt +++ /dev/null diff --git a/taskdefs/pom.xml b/taskdefs/pom.xml index 7185b9b5f..55f5436e0 100644 --- a/taskdefs/pom.xml +++ b/taskdefs/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>taskdefs</artifactId> diff --git a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java index e49580dbe..260d16d90 100644 --- a/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java +++ b/taskdefs/src/main/java/org/aspectj/tools/ant/taskdefs/AjcTask.java @@ -250,9 +250,18 @@ public class AjcTask extends MatchingTask { public static final String COMMAND_EDITOR_NAME = AjcTask.class.getName() + ".COMMAND_EDITOR"; - static final String[] TARGET_INPUTS = new String[] { "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11", "12", "13", "14", "15", "16", "17" }; - static final String[] SOURCE_INPUTS = new String[] { "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", "10", "11", "12", "13", "14", "15", "16", "17" }; - static final String[] COMPLIANCE_INPUTS = new String[] { "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17" }; + static final String[] TARGET_INPUTS = new String[] { + "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", + "10", "11", "12", "13", "14", "15", "16", "17", "18" + }; + static final String[] SOURCE_INPUTS = new String[] { + "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "9", + "10", "11", "12", "13", "14", "15", "16", "17", "18" + }; + static final String[] COMPLIANCE_INPUTS = new String[] { + "-1.3", "-1.4", "-1.5", "-1.6", "-1.7", "-1.8", "-1.9", "-9", + "-10", "-11", "-12", "-13", "-14", "-15", "-16", "-17", "-18" + }; private static final ICommandEditor COMMAND_EDITOR; diff --git a/testing-client/pom.xml b/testing-client/pom.xml index 401fff9f9..864dac12c 100644 --- a/testing-client/pom.xml +++ b/testing-client/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>testing-client</artifactId> diff --git a/testing-drivers/pom.xml b/testing-drivers/pom.xml index 37052d85f..30b75c3ca 100644 --- a/testing-drivers/pom.xml +++ b/testing-drivers/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>testing-drivers</artifactId> @@ -55,7 +55,10 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <testFailureIgnore>false</testFailureIgnore> - <argLine>${jvm.arg.addOpens}</argLine> + <argLine> + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + </argLine> <excludes> <exclude>**/*AjcTestSpecAsTest*</exclude> </excludes> diff --git a/testing-util/pom.xml b/testing-util/pom.xml index 4324b06df..a596d0c99 100644 --- a/testing-util/pom.xml +++ b/testing-util/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>testing-util</artifactId> diff --git a/testing/pom.xml b/testing/pom.xml index 2314f1cd4..ae7fd0d9a 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>testing</artifactId> diff --git a/testing/src/test/java/org/aspectj/testing/RunSpec.java b/testing/src/test/java/org/aspectj/testing/RunSpec.java index d687ae86b..c50b40f76 100644 --- a/testing/src/test/java/org/aspectj/testing/RunSpec.java +++ b/testing/src/test/java/org/aspectj/testing/RunSpec.java @@ -36,6 +36,7 @@ public class RunSpec implements ITestStep { private String options; private String cpath; private String mpath; + private String orderedStdout; private String orderedStderr; private AjcTest myTest; private OutputSpec stdErrSpec; @@ -70,6 +71,10 @@ public class RunSpec implements ITestStep { // On Java 16+, LTW no longer works without this parameter. Add the argument here and not in AjcTestCase::run, // because even if 'useLTW' and 'useFullLTW' are not set, we might in the future have tests for weaver attachment // during runtime. See also docs/dist/doc/README-187.html. + // + // The reason for setting this parameter for Java 9+ instead of 16+ is that it helps to avoid the JVM printing + // unwanted illegal access warnings during weaving in 'useFullLTW' mode, either making existing tests fail or + // having to assert on the warning messages. vmargs += is16VMOrGreater() ? " --add-opens java.base/java.lang=ALL-UNNAMED" : ""; AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw)); @@ -78,7 +83,7 @@ public class RunSpec implements ITestStep { stdErrSpec.matchAgainst(rr.getStdErr(), orderedStderr); } if (stdOutSpec != null) { - stdOutSpec.matchAgainst(rr.getStdOut()); + stdOutSpec.matchAgainst(rr.getStdOut(), orderedStdout); } } finally { restoreProperties(); @@ -171,6 +176,10 @@ public class RunSpec implements ITestStep { this.orderedStderr = orderedStderr; } + public void setOrderedStdout(String orderedStdout) { + this.orderedStdout = orderedStdout; + } + public String getClassToRun() { return classToRun; } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java index 3954c7ecc..6af8ced47 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -251,6 +251,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { digester.addSetProperties("suite/ajc-test/run", "module", "moduleToRun"); digester.addSetProperties("suite/ajc-test/run", "ltw", "ltwFile"); digester.addSetProperties("suite/ajc-test/run", "xlintfile", "xlintFile"); + digester.addSetProperties("suite/ajc-test/run/stdout", "ordered", "orderedStdout"); digester.addSetProperties("suite/ajc-test/run/stderr", "ordered", "orderedStderr"); digester.addSetNext("suite/ajc-test/run", "addTestStep", "org.aspectj.testing.ITestStep"); digester.addObjectCreate("*/message", ExpectedMessageSpec.class); diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java index 0c351c69a..78941fcab 100644 --- a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava17Only.java @@ -20,21 +20,21 @@ public abstract class XMLBasedAjcTestCaseForJava17Only extends XMLBasedAjcTestCa @Override public void setUp() throws Exception { // Activate this block after upgrading to JDT Core Java 18 - /* throw new IllegalStateException( "These tests need a Java 17 level AspectJ compiler " + "(e.g. because they use version-specific preview features). " + "This compiler does not support preview features of a previous version anymore." ); - */ // Activate this block before upgrading to JDT Core Java 18 + /* if (!LangUtil.is17VMOrGreater() || LangUtil.is18VMOrGreater()) { throw new IllegalStateException( "These tests should be run on Java 17 only " + "(e.g. because they use version-specific preview features)" ); - } super.setUp(); + } + */ } } diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java new file mode 100644 index 000000000..ba4d00605 --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18Only.java @@ -0,0 +1,40 @@ +/* ******************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * ******************************************************************/ +package org.aspectj.testing; + +import org.aspectj.util.LangUtil; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Alexander Kriegisch + */ +public abstract class XMLBasedAjcTestCaseForJava18Only extends XMLBasedAjcTestCase { + + @Override + public void setUp() throws Exception { + // Activate this block after upgrading to JDT Core Java 19 + /* + throw new IllegalStateException( + "These tests need a Java 18 level AspectJ compiler " + + "(e.g. because they use version-specific preview features). " + + "This compiler does not support preview features of a previous version anymore." + ); + */ + // Activate this block before upgrading to JDT Core Java 19 + if (!LangUtil.is18VMOrGreater() || LangUtil.is19VMOrGreater()) { + throw new IllegalStateException( + "These tests should be run on Java 18 only " + + "(e.g. because they use version-specific preview features)" + ); + } + super.setUp(); + } + +} diff --git a/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java new file mode 100644 index 000000000..9b9efdd34 --- /dev/null +++ b/testing/src/test/java/org/aspectj/testing/XMLBasedAjcTestCaseForJava18OrLater.java @@ -0,0 +1,27 @@ +/* ******************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. + * This program and the accompanying materials are made available + * under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + * ******************************************************************/ +package org.aspectj.testing; + +import org.aspectj.util.LangUtil; + +/** + * Makes sure tests are running on the right level of JDK. + * + * @author Alexander Kriegisch + */ +public abstract class XMLBasedAjcTestCaseForJava18OrLater extends XMLBasedAjcTestCase { + + @Override + public void setUp() throws Exception { + if (!LangUtil.is18VMOrGreater()) + throw new IllegalStateException("These tests should be run on Java 18 or later"); + super.setUp(); + } + +} diff --git a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java index 93ca14e70..fa3315396 100644 --- a/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java +++ b/testing/src/test/java/org/aspectj/testing/harness/bridge/JavaRun.java @@ -600,6 +600,9 @@ public class JavaRun implements IAjcRun { public static class Spec extends AbstractRunSpec { static { try { + // TODO: Deprecate the Security Manager for Removal, see https://openjdk.java.net/jeps/411. + // As of Java 18, the new API for blocking System.exit is not available yet, see + // https://bugs.openjdk.java.net/browse/JDK-8199704. System.setSecurityManager(RunSecurityManager.ME); } catch (Throwable t) { System.err.println("JavaRun: Security manager set - no System.exit() protection"); diff --git a/tests/bugs198/github_115/A.java b/tests/bugs199/github_115/A.java index 07df21f10..07df21f10 100644 --- a/tests/bugs198/github_115/A.java +++ b/tests/bugs199/github_115/A.java diff --git a/tests/bugs198/github_115/B.java b/tests/bugs199/github_115/B.java index eba199b67..eba199b67 100644 --- a/tests/bugs198/github_115/B.java +++ b/tests/bugs199/github_115/B.java diff --git a/tests/bugs198/github_120/C.java b/tests/bugs199/github_120/C.java index 4af57af24..4af57af24 100644 --- a/tests/bugs198/github_120/C.java +++ b/tests/bugs199/github_120/C.java diff --git a/tests/bugs198/github_120/D.java b/tests/bugs199/github_120/D.java index 2ecdaa574..2ecdaa574 100644 --- a/tests/bugs198/github_120/D.java +++ b/tests/bugs199/github_120/D.java diff --git a/tests/bugs198/github_122/E.java b/tests/bugs199/github_122/E.java index 29c818285..29c818285 100644 --- a/tests/bugs198/github_122/E.java +++ b/tests/bugs199/github_122/E.java diff --git a/tests/bugs198/github_125/Application.java b/tests/bugs199/github_125/Application.java index 7e893fc1a..7e893fc1a 100644 --- a/tests/bugs198/github_125/Application.java +++ b/tests/bugs199/github_125/Application.java diff --git a/tests/bugs199/github_128/Application.java b/tests/bugs199/github_128/Application.java new file mode 100644 index 000000000..9a4a7312f --- /dev/null +++ b/tests/bugs199/github_128/Application.java @@ -0,0 +1,42 @@ +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +public class Application { + static int proceedTimesOuter; + static int proceedTimesInner; + static boolean useThreadPool = false; + static ExecutorService executorService = Executors.newFixedThreadPool(2); + + @MarkerA + @MarkerB + public void doSomething() { + System.out.println(" Doing something"); + } + + public static void main(String[] args) throws ExecutionException, InterruptedException { + proceedTimesOuter = Integer.parseInt(args[0]); + proceedTimesInner = Integer.parseInt(args[1]); + useThreadPool = args.length > 2 && args[2].trim().equalsIgnoreCase("true"); + if (useThreadPool) + prepopulateFixedThreadPool(); + + new Application().doSomething(); + Thread.sleep(500); + } + + private static void prepopulateFixedThreadPool() throws InterruptedException, ExecutionException { + Future<?> future1 = executorService.submit(() -> { + try { Thread.sleep(250); } + catch (InterruptedException e) { e.printStackTrace(); } + }); + Future<?> future2 = executorService.submit(() -> { + try { Thread.sleep(250); } + catch (InterruptedException e) { e.printStackTrace(); } + }); + future1.get(); + future2.get(); + } + +} diff --git a/tests/bugs199/github_128/MarkerA.java b/tests/bugs199/github_128/MarkerA.java new file mode 100644 index 000000000..89e60978c --- /dev/null +++ b/tests/bugs199/github_128/MarkerA.java @@ -0,0 +1,9 @@ +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Retention(RUNTIME) +@Target(METHOD) +public @interface MarkerA {} diff --git a/tests/bugs199/github_128/MarkerB.java b/tests/bugs199/github_128/MarkerB.java new file mode 100644 index 000000000..6f6aa3dd0 --- /dev/null +++ b/tests/bugs199/github_128/MarkerB.java @@ -0,0 +1,9 @@ +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +@Retention(RUNTIME) +@Target(METHOD) +public @interface MarkerB {} diff --git a/tests/bugs199/github_128/annotation_syntax/MarkerAAspect.aj b/tests/bugs199/github_128/annotation_syntax/MarkerAAspect.aj new file mode 100644 index 000000000..d090ed9ea --- /dev/null +++ b/tests/bugs199/github_128/annotation_syntax/MarkerAAspect.aj @@ -0,0 +1,21 @@ +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.DeclarePrecedence; + +@Aspect +@DeclarePrecedence("MarkerAAspect, MarkerBAspect") +public class MarkerAAspect { + @Around("@annotation(MarkerA) && execution(* *(..))") + public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable { + System.out.println(">> Outer intercept"); + Object result = null; + for (int i = 0; i < Application.proceedTimesOuter; i++) { + System.out.println(" >> Outer proceed"); + result = thisJoinPoint.proceed(); + System.out.println(" << Outer proceed"); + } + System.out.println("<< Outer intercept"); + return result; + } +} diff --git a/tests/bugs199/github_128/annotation_syntax/MarkerBAspect.aj b/tests/bugs199/github_128/annotation_syntax/MarkerBAspect.aj new file mode 100644 index 000000000..d5548f9da --- /dev/null +++ b/tests/bugs199/github_128/annotation_syntax/MarkerBAspect.aj @@ -0,0 +1,37 @@ +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +@Aspect +public class MarkerBAspect { + @Around("@annotation(MarkerB) && execution(* *(..))") + public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable { + Runnable runnable = new Runnable() { + @Override + public void run() { + try { + for (int i = 0; i < Application.proceedTimesInner; i++) { + System.out.println(" >> Inner proceed"); + thisJoinPoint.proceed(); + System.out.println(" << Inner proceed"); + } + } + catch (Throwable throwable) { + throwable.printStackTrace(System.out); + } + } + }; + + System.out.println(" >> Inner intercept"); + if (Application.useThreadPool) + Application.executorService.submit(runnable); + else + new Thread(runnable).start(); + System.out.println(" << Inner intercept"); + return null; + } +} diff --git a/tests/bugs199/github_128/native_syntax/MarkerAAspect.aj b/tests/bugs199/github_128/native_syntax/MarkerAAspect.aj new file mode 100644 index 000000000..5e2ac5424 --- /dev/null +++ b/tests/bugs199/github_128/native_syntax/MarkerAAspect.aj @@ -0,0 +1,15 @@ +public aspect MarkerAAspect { + declare precedence : MarkerAAspect, MarkerBAspect; + + Object around() : @annotation(MarkerA) && execution(* *(..)) { + System.out.println(">> Outer intercept"); + Object result = null; + for (int i = 0; i < Application.proceedTimesOuter; i++) { + System.out.println(" >> Outer proceed"); + result = proceed(); + System.out.println(" << Outer proceed"); + } + System.out.println("<< Outer intercept"); + return result; + } +} diff --git a/tests/bugs199/github_128/native_syntax/MarkerBAspect.aj b/tests/bugs199/github_128/native_syntax/MarkerBAspect.aj new file mode 100644 index 000000000..52e95d1eb --- /dev/null +++ b/tests/bugs199/github_128/native_syntax/MarkerBAspect.aj @@ -0,0 +1,27 @@ +public aspect MarkerBAspect { + Object around() : @annotation(MarkerB) && execution(* *(..)) { + Runnable runnable = new Runnable() { + @Override + public void run() { + try { + for (int i = 0; i < Application.proceedTimesInner; i++) { + System.out.println(" >> Inner proceed"); + proceed(); + System.out.println(" << Inner proceed"); + } + } + catch (Throwable throwable) { + throwable.printStackTrace(System.out); + } + } + }; + + System.out.println(" >> Inner intercept"); + if (Application.useThreadPool) + Application.executorService.submit(runnable); + else + new Thread(runnable).start(); + System.out.println(" << Inner intercept"); + return null; + } +} diff --git a/tests/bugs199/github_145/add_exports/Application.java b/tests/bugs199/github_145/add_exports/Application.java new file mode 100644 index 000000000..88bd177aa --- /dev/null +++ b/tests/bugs199/github_145/add_exports/Application.java @@ -0,0 +1,17 @@ +import sun.security.x509.X509CertInfo; + +import java.security.cert.CertificateParsingException; + +/** + * https://github.com/mojohaus/aspectj-maven-plugin/issues/139 + */ +public class Application { + public static void main(String[] args) { + try { + new X509CertInfo(new byte[0]); + } + catch (CertificateParsingException e) { + System.out.println(e); + } + } +} diff --git a/tests/bugs199/github_145/add_modules/NonModular.java b/tests/bugs199/github_145/add_modules/NonModular.java new file mode 100644 index 000000000..6bdaffa06 --- /dev/null +++ b/tests/bugs199/github_145/add_modules/NonModular.java @@ -0,0 +1,9 @@ +import my.module.Modular; + +public class NonModular { + Modular modular = new Modular(); + + public static void main(String[] args) { + System.out.println("Non-modular class can use modular one"); + } +} diff --git a/tests/bugs199/github_145/add_modules/UseJDKExtendedCharsets.java b/tests/bugs199/github_145/add_modules/UseJDKExtendedCharsets.java new file mode 100644 index 000000000..62a351868 --- /dev/null +++ b/tests/bugs199/github_145/add_modules/UseJDKExtendedCharsets.java @@ -0,0 +1,24 @@ +import java.nio.charset.Charset; +import sun.nio.cs.ext.ExtendedCharsets; + +/** + * Note that the Windows JDK knows many more extended charsets than the Linux one. Originally, this test was using + * "hebrew", but that yielded failing GitHub CI tests due to the unavailability of the character set there. I actually + * had to inspect a Linux 'lib/modules' file using 'jimage' in order to filter for available 'ISO*' classes in the + * extended character set package. So if this test ever breaks again on any OS platform, you know where to look for the + * root cause and have a clue how to fix the test. + */ +public class UseJDKExtendedCharsets { + static ExtendedCharsets charsets = new ExtendedCharsets(); + static Charset iso2022jp = charsets.charsetForName("ISO-2022-JP"); + static Charset jis = charsets.charsetForName("jis"); + static Charset jis_encoding = charsets.charsetForName("jis_encoding"); + + public static void main(String[] args) { + // The 3 charsets are aliases of each other + assert iso2022jp != null; + System.out.println(iso2022jp); + assert iso2022jp.equals(jis); + assert iso2022jp.equals(jis_encoding); + } +} diff --git a/tests/bugs199/github_145/add_modules/my.module/module-info.java b/tests/bugs199/github_145/add_modules/my.module/module-info.java new file mode 100644 index 000000000..beee5b586 --- /dev/null +++ b/tests/bugs199/github_145/add_modules/my.module/module-info.java @@ -0,0 +1,3 @@ +module my.module { + //exports my.module; +} diff --git a/tests/bugs199/github_145/add_modules/my.module/my/module/Modular.java b/tests/bugs199/github_145/add_modules/my.module/my/module/Modular.java new file mode 100644 index 000000000..febc7f821 --- /dev/null +++ b/tests/bugs199/github_145/add_modules/my.module/my/module/Modular.java @@ -0,0 +1,3 @@ +package my.module; + +public class Modular {} diff --git a/tests/bugs199/github_145/add_reads/other.module/module-info.java b/tests/bugs199/github_145/add_reads/other.module/module-info.java new file mode 100644 index 000000000..3cc4823e7 --- /dev/null +++ b/tests/bugs199/github_145/add_reads/other.module/module-info.java @@ -0,0 +1,3 @@ +module other.module { + exports other.module; +} diff --git a/tests/bugs199/github_145/add_reads/other.module/other/module/Application.java b/tests/bugs199/github_145/add_reads/other.module/other/module/Application.java new file mode 100644 index 000000000..ff299017e --- /dev/null +++ b/tests/bugs199/github_145/add_reads/other.module/other/module/Application.java @@ -0,0 +1,15 @@ +package other.module; + +import java.util.ArrayList; +import java.util.List; + +import my.module.Modular; + +public class Application { + List<String> list = new ArrayList<>(); + Modular modular = new Modular(); + + public static void main(String[] args) { + System.out.println("One modular class can use another one"); + } +} diff --git a/tests/features199/java18/SwitchPatternPreview2Aspect.aj b/tests/features199/java18/SwitchPatternPreview2Aspect.aj new file mode 100644 index 000000000..4170b4d15 --- /dev/null +++ b/tests/features199/java18/SwitchPatternPreview2Aspect.aj @@ -0,0 +1,26 @@ +aspect SwitchPatternPreview2Aspect { + Object around(Integer i): execution(* doSomethingWithInteger(*)) && args(i) { + System.out.println( + switch (i) { + case null -> "value unavailable: " + i; + case -1, 1 -> "absolute value 1: " + i; + case Integer value && value > 0 -> "positive integer: " + i; + default -> "other integer: " + i; + } + ); + return proceed(i); + } +} + +class Application { + public static void main(String[] args) { + doSomethingWithInteger(-1); + doSomethingWithInteger(0); + doSomethingWithInteger(42); + doSomethingWithInteger(-99); + doSomethingWithInteger(Integer.valueOf(123)); + doSomethingWithInteger(null); + } + + public static Object doSomethingWithInteger(Integer o) { return o; } +} diff --git a/tests/features199/java18/SwitchPatternPreview2Error1.java b/tests/features199/java18/SwitchPatternPreview2Error1.java new file mode 100644 index 000000000..342b848aa --- /dev/null +++ b/tests/features199/java18/SwitchPatternPreview2Error1.java @@ -0,0 +1,13 @@ +/** + * Inspired by examples in https://openjdk.java.net/jeps/420 + */ +public class SwitchPatternPreview2Error1 { + static void constantLabelsMustAppearBeforePatterns1(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + case Integer value && value > 0 -> System.out.println("positive integer: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + default -> System.out.println("other integer: " + i); + } + } +} diff --git a/tests/features199/java18/SwitchPatternPreview2Error2.java b/tests/features199/java18/SwitchPatternPreview2Error2.java new file mode 100644 index 000000000..3cee435e0 --- /dev/null +++ b/tests/features199/java18/SwitchPatternPreview2Error2.java @@ -0,0 +1,21 @@ +/** + * Inspired by examples in https://openjdk.java.net/jeps/420 + */ +public class SwitchPatternPreview2Error2 { + static void constantLabelsMustAppearBeforePatterns2(Object o) { + switch (o) { + case null -> System.out.println("value unavailable: " + o); + // This seems to be a bug in JEP 420 implementation. Those constants should be compatible with 'Object'. + // case -1, 1 -> System.out.println("absolute value 1: " + o); + // case "hello" -> System.out.println("string value: " + o); + + // 'Integer value' dominates the next two, more specific ones -> error + case Integer value -> System.out.println("other integer: " + o); + case Integer value && (value == 1 || value == -1) -> System.out.println("absolute value 1: " + o); + case Integer value && value > 0 -> System.out.println("positive integer: " + o); + + case String value && value.startsWith("hello") -> System.out.println("greeting: " + o); + default -> System.out.println("other type: " + o); + } + } +} diff --git a/tests/features199/java18/SwitchPatternPreview2OK.java b/tests/features199/java18/SwitchPatternPreview2OK.java new file mode 100644 index 000000000..b36b26bf2 --- /dev/null +++ b/tests/features199/java18/SwitchPatternPreview2OK.java @@ -0,0 +1,113 @@ +/** + * Inspired by examples in https://openjdk.java.net/jeps/420 + */ +public class SwitchPatternPreview2OK { + public static void main(String[] args) { +// constantLabelMustAppearBeforePattern(-1); +// constantLabelMustAppearBeforePattern(0); +// constantLabelMustAppearBeforePattern(42); +// constantLabelMustAppearBeforePattern(-99); +// constantLabelMustAppearBeforePattern(Integer.valueOf(123)); +// constantLabelMustAppearBeforePattern(null); + + constantLabelMustAppearBeforePatternInteger(-1); + constantLabelMustAppearBeforePatternInteger(0); + constantLabelMustAppearBeforePatternInteger(42); + constantLabelMustAppearBeforePatternInteger(-99); + constantLabelMustAppearBeforePatternInteger(Integer.valueOf(123)); + constantLabelMustAppearBeforePatternInteger(null); + +// System.out.println(testGenericSealedExhaustive(new B<Integer>())); + } + + /** + * According to an example from JEP 420, this should work, but it does not, neither with Javac nor ECJ. + * + * See: + * https://openjdk.java.net/jeps/420#1b--Dominance-of-pattern-labels + * https://bugs.openjdk.java.net/browse/JDK-8273326 + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=579355 + * + * TODO: reactivate when implemented or move to preview 3 with Java 19, Eclipse 4.24. + */ + /* + static String constantLabelMustAppearBeforePattern(Object o) { + switch (o) { + case null -> System.out.println("value unavailable: " + i); + case -1, 1 -> System.out.println("special case:" + o); + case Integer i && i > 0 -> System.out.println("positive integer: " + o); + case Integer i -> System.out.println("other integer: " + o); + default -> System.out.println("non-integer: " + o); + } + return i == null ? "null" : i.toString(); + } + */ + + static String constantLabelMustAppearBeforePatternInteger(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + case Integer value && value > 0 -> System.out.println("positive integer: " + i); + default -> System.out.println("other integer: " + i); + } + return i == null ? "null" : i.toString(); + } + + static void nullCanAppearAfterConstantLabel(Integer i) { + switch (i) { + case -1, 1 -> System.out.println("absolute value 1: " + i); + case null -> System.out.println("value unavailable: " + i); + case Integer value && value > 0 -> System.out.println("positive integer: " + i); + default -> System.out.println("other integer: " + i); + } + } + + static void defaultCanAppearBeforePattern(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + default -> System.out.println("other integer: " + i); + case Integer value && value > 0 -> System.out.println("positive integer: " + i); + } + } + + static void defaultCanAppearBeforeNull(Integer i) { + switch (i) { + case -1, 1 -> System.out.println("absolute value 1: " + i); + default -> System.out.println("other integer: " + i); + case null -> System.out.println("value unavailable: " + i); + case Integer value && value > 0 -> System.out.println("positive integer: " + i); + } + } + + static void defaultCanAppearBeforeConstantLabel(Integer i) { + switch (i) { + case null -> System.out.println("value unavailable: " + i); + default -> System.out.println("other integer: " + i); + case -1, 1 -> System.out.println("absolute value 1: " + i); + case Integer value && value > 0 -> System.out.println("positive integer: " + i); + } + } + + /** + * According to an example from JEP 420, this should work, and it does with Javac, but not with ECJ. + * + * See: + * https://openjdk.java.net/jeps/420#2--Exhaustiveness-of-switch-expressions-and-statements + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=579360 + * + * TODO: reactivate when implemented or move to preview 3 with Java 19, Eclipse 4.24. + */ + /* + sealed interface I<T> permits A, B {} + final static class A<X> implements I<String> {} + final static class B<Y> implements I<Y> {} + + static int testGenericSealedExhaustive(I<Integer> i) { + return switch (i) { + // Exhaustive as no A case possible! + case B<Integer> bi -> 42; + }; + } + */ +} diff --git a/tests/pom.xml b/tests/pom.xml index 33801c2f5..7b5e400bd 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>tests</artifactId> @@ -122,7 +122,10 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration combine.self="override"> <testFailureIgnore>false</testFailureIgnore> - <argLine>${jvm.arg.addOpens}</argLine> + <argLine> + ${jvm.arg.addOpens} + ${jvm.arg.allowSecurityManager} + </argLine> <includes> <include>**/TestsModuleTests*</include> </includes> diff --git a/tests/product/ant-example.xml b/tests/product/ant-example.xml index 1dda5c944..4f0160cd6 100644 --- a/tests/product/ant-example.xml +++ b/tests/product/ant-example.xml @@ -33,7 +33,7 @@ <!-- ========================================================================== --> <target name="init" depends="init.product" description="caller must define jdk.tools.jar and product.dir or run from product.dir"> - <echo message="init ant-examples.xml"/> + <echo message="init ant-examples.xml"/> <!-- directory produced during test install --> <property name="ajx.base.dir" location="${productTest.output.dir}/ajx-output"/> @@ -90,14 +90,14 @@ <mkdir dir="${noclass.dir}"/> <delete dir="${noclass.dir}"/> <mkdir dir="${noclass.dir}"/> - <javac srcdir="." - includes="${noclass}.java" + <javac srcdir="." + includes="${noclass}.java" destdir="${noclass.dir}" failonerror="true"/> <delete file="${noclass}.java"/> <echo message=" todo check file: ${noclass}.java"/> <java classname="${noclass}" - failonerror="true" + failonerror="true" classpath="${noclass.dir}"/> </target> @@ -107,7 +107,7 @@ <target name="Ajx" depends="init.taskdefs" description="for {example}, compile {list}, doc {list}, and run {class}"> <echo message="##### START Ajx example=${example} list=${list} class=${class}" /> - <property name="exdir" + <property name="exdir" value="${ajx.base.dir}/${example}"/> <property name="expect.exdir" value="${ajx.expect.dir}/${example}"/> <mkdir dir="${exdir}/classes"/> @@ -121,9 +121,9 @@ <mkdir dir="${exdir}/docs"/> <echo message="##################### Ajx ajc ${list}"/> - <ajc + <ajc destdir="${exdir}/classes" - argfile="${list}" + argfile="${list}" failonerror="false" > <classpath> <pathelement location="${product.rt.jar}" /> @@ -132,7 +132,7 @@ </ajc> <!-- copying resources, etc. as javac does todo weak --> <copy todir="${exdir}/classes"> - <fileset dir="${srcDir}" + <fileset dir="${srcDir}" includes="**/*.properties,**/*.gif,**/*.jpg,**/*.props" /> </copy> @@ -142,11 +142,11 @@ verbose="yes" sourcepath="${product.examples.dir}" destdir="${exdir}/docs" - argfile="${list}" + argfile="${list}" classpath="${product.rt.jar}${PS}${jdk.tools.jar}" failonerror="false" > - <!-- internalclasspath - internalclasspath="${taskdef.classpath}" + <!-- internalclasspath + internalclasspath="${taskdef.classpath}" is required now - but still not producing docs <classpath> <pathelement location="${product.rt.jar}" /> @@ -157,7 +157,7 @@ <echo message="##################### Ajx run ${class} START - output in ${exdir}/output/out.txt"/> <java classname="${class}" output="${exdir}/output/out.txt" - fork="yes" + fork="yes" failonerror="false" > <!-- fork because ajc does a System.exit --> <classpath> @@ -201,12 +201,6 @@ <param name="srcDir" value="${tools.src.dir}"/> </antcall> <antcall target="Ajx"> - <param name="list" value="${tools.src.dir}/ajbrowser.lst"/> - <param name="example" value="source-tools-ajbrowser"/> - <param name="class" value="${noclass}"/> - <param name="srcDir" value="${tools.src.dir}"/> - </antcall> - <antcall target="Ajx"> <param name="list" value="${tools.src.dir}/ajdoc.lst"/> <param name="example" value="source-tools-ajdoc"/> <param name="class" value="org.aspectj.tools.ajdoc.Main"/> @@ -289,7 +283,7 @@ <param name="class" value="telecom.TimingSimulation"/> <param name="srcDir" value="."/> </antcall> - <!-- timeserver not in product - todo check + <!-- timeserver not in product - todo check <antcall target="Ajx"> <param name="list" value="timeserver/abort.lst"/> <param name="example" value="timeserver-abort"/> diff --git a/tests/product/build-aspectj/build.xml b/tests/product/build-aspectj/build.xml index 85b0670a6..d810aabc6 100644 --- a/tests/product/build-aspectj/build.xml +++ b/tests/product/build-aspectj/build.xml @@ -112,7 +112,6 @@ </path> <path id="tools.roots"> - <pathelement path="${aspectj.src}/ajbrowser/src"/> <pathelement path="${aspectj.src}/ajde/src"/> <pathelement path="${aspectj.src}/asm/src"/> <pathelement path="${aspectj.src}/bridge/src"/> diff --git a/tests/product/product-test.xml b/tests/product/product-test.xml index c5f1146d3..776e9d7d3 100644 --- a/tests/product/product-test.xml +++ b/tests/product/product-test.xml @@ -31,14 +31,14 @@ <!-- This only runs from ../../test-product.xml b/c it uses comparefiles w/o defining it --> <project name="product-test" default="test" basedir="."> - &aspectj_initProduct; + &aspectj_initProduct; <!-- ========================================================================== --> <!-- Init --> <!-- ========================================================================== --> <target name="init" depends="init.product,productTest.expect.dir" description="init values - launch from install dir or set product.dir variable"> - <echo message="init product-test.xml"/> + <echo message="init product-test.xml"/> <property name="productTest.classes.dir" location="${productTest.output.dir}/classes"/> <property name="script.expect.dir" @@ -64,11 +64,11 @@ <!-- ========================================================================== --> <!-- Run product tests --> <!-- ========================================================================== --> - <target name="test" + <target name="test" depends="test.examples.buildscript,test.script.telecom,test.tools.sources" description="run available tests"/> - <target name="test.script.telecom" + <target name="test.script.telecom" depends="init,productTest.dir,product.dir, productTest.expect.bat.dir,productTest.output.dir" description="ajc/ajdoc/java/ajdb telecom example using bat scripts"> @@ -138,11 +138,11 @@ </exec> <comparefiles lhsFile="${ajdb.out}" rhsFile="${expect.ajdb.out}"/> - </target> + </target> <!-- todo: also depends on jdk.tools.jar --> <!-- todo: ignore as duplicating examples/build.xml --> - <target name="test.examples.antscript" + <target name="test.examples.antscript" depends="init,productTest.dir,product.dir, product.taskdefs.jar,product.rt.jar, product.tools.jar" @@ -151,18 +151,18 @@ <ant antfile="${productTest.dir}/ant-example.xml" dir="${product.examples.dir}" output="${productTest.output.dir}/ant-example.ant.txt"> - <property name="PS" + <property name="PS" value="${path.separator}"/> - <property name="product.dir" + <property name="product.dir" value="${product.dir}"/> - <property name="jdk.tools.jar" + <property name="jdk.tools.jar" location="${jdk.tools.jar}"/> - <property name="jdk.dir" + <property name="jdk.dir" location="${jdk.dir}"/> </ant> </target> - <target name="test.examples.buildscript" + <target name="test.examples.buildscript" depends="init,product.dir, product.taskdefs.jar,product.rt.jar, product.tools.jar" @@ -184,14 +184,14 @@ <param name="example.target" value="nonGui" /> </antcall> - <!-- OutOfMemory if including all + <!-- OutOfMemory if including all <antcall target="antcall.test.examples.buildscript.norun"> <param name="example.target" value="all" /> </antcall> --> </target> - <target name="antcall.test.examples.buildscript.norun" + <target name="antcall.test.examples.buildscript.norun" depends="init,product.dir, product.taskdefs.jar,product.rt.jar, product.tools.jar" @@ -202,14 +202,14 @@ target="${example.target}" dir="${product.examples.dir}" output="${productTest.output.dir}/example-build.${example.target}.txt" > - <property name="JAVA_HOME" - location="${jdk.dir}"/> - <property name="norun" - location="skipRunning"/> + <property name="JAVA_HOME" + location="${jdk.dir}"/> + <property name="norun" + location="skipRunning"/> </ant> </target> - <target name="antcall.test.examples.buildscript" + <target name="antcall.test.examples.buildscript" depends="init,product.dir, product.taskdefs.jar,product.rt.jar, product.tools.jar" @@ -220,18 +220,18 @@ target="${example.target}" dir="${product.examples.dir}" output="${productTest.output.dir}/example-build.${example.target}.txt" > - <property name="JAVA_HOME" - location="${jdk.dir}"/> + <property name="JAVA_HOME" + location="${jdk.dir}"/> </ant> </target> <!-- see also more recent devenv/dev/bin/aj/testToolsSrc.sh --> - <target name="test.tools.sources" + <target name="test.tools.sources" depends="init,product.tools.jar,product.src.dir" description="test source dist using ajc, ajdoc (todo remove - see ant-example)"> - <property name="tools.source.out" + <property name="tools.source.out" location="${productTest.output.dir}/source-tools"/> <property name="test.source.classes.dir" location="${productTest.output.dir}/source-tools"/> @@ -253,9 +253,6 @@ <param name="target.name" value="ajde" /> </antcall> <antcall target="build.source.call"> - <param name="target.name" value="ajbrowser" /> - </antcall> - <antcall target="build.source.call"> <param name="target.name" value="ajdoc" /> </antcall> @@ -290,4 +287,3 @@ </target> </project> - diff --git a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java index 7223aff59..d14bc54cb 100644 --- a/tests/src/test/java/org/aspectj/systemtest/AllTests19.java +++ b/tests/src/test/java/org/aspectj/systemtest/AllTests19.java @@ -18,6 +18,7 @@ import junit.framework.Test; import junit.framework.TestSuite; import org.aspectj.systemtest.ajc197.AllTestsAspectJ197; import org.aspectj.systemtest.ajc198.AllTestsAspectJ198; +import org.aspectj.systemtest.ajc199.AllTestsAspectJ199; /** * @author Andy Clement @@ -36,6 +37,7 @@ public class AllTests19 { suite.addTest(AllTestsAspectJ196.suite()); suite.addTest(AllTestsAspectJ197.suite()); suite.addTest(AllTestsAspectJ198.suite()); + suite.addTest(AllTestsAspectJ199.suite()); suite.addTest(AllTests18.suite()); // $JUnit-END$ return suite; diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc152/Ajc152Tests.java index 8bcdb63e0..da8d057b1 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -168,7 +168,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { } public void testLTWGeneratedAspectAbstractMethod_pr125480() { - runTest("aop.xml aspect inheriting abstract method "); + runTest("aop.xml aspect inheriting abstract method"); } public void testLTWGeneratedAspectAbstractMethod_pr125480_2() { diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java index ef597c8f1..3e6ead467 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Ajc198TestsJava.java @@ -17,35 +17,29 @@ import org.aspectj.testing.XMLBasedAjcTestCaseForJava17OrLater; */ public class Ajc198TestsJava extends XMLBasedAjcTestCaseForJava17OrLater { - public void testSealedClassWithLegalSubclasses() { - runTest("sealed class with legal subclasses"); - // TODO: replace 0 by Constants.PREVIEW_MINOR_VERSION after no longer using EA - // build, but final JDK version - checkVersion("Employee", Constants.MAJOR_17, 0 /* Constants.PREVIEW_MINOR_VERSION */); - checkVersion("Manager", Constants.MAJOR_17, 0 /* Constants.PREVIEW_MINOR_VERSION */); - } - - public void testSealedClassWithIllegalSubclass() { - runTest("sealed class with illegal subclass"); - // TODO: replace 0 by Constants.PREVIEW_MINOR_VERSION after no longer using EA - // build, but final JDK version - checkVersion("Person", Constants.MAJOR_17, 0 /* Constants.PREVIEW_MINOR_VERSION */); - } - - public void testWeaveSealedClass() { - runTest("weave sealed class"); - // TODO: replace 0 by Constants.PREVIEW_MINOR_VERSION after no longer using EA - // build, but final JDK version - checkVersion("PersonAspect", Constants.MAJOR_17, 0 /* Constants.PREVIEW_MINOR_VERSION */); - } - - public static Test suite() { - return XMLBasedAjcTestCase.loadSuite(Ajc198TestsJava.class); - } - - @Override - protected java.net.URL getSpecFile() { - return getClassResource("ajc198.xml"); - } + public void testSealedClassWithLegalSubclasses() { + runTest("sealed class with legal subclasses"); + checkVersion("Employee", Constants.MAJOR_17, Constants.MINOR_17); + checkVersion("Manager", Constants.MAJOR_17, Constants.MINOR_17); + } + + public void testSealedClassWithIllegalSubclass() { + runTest("sealed class with illegal subclass"); + checkVersion("Person", Constants.MAJOR_17, Constants.MINOR_17); + } + + public void testWeaveSealedClass() { + runTest("weave sealed class"); + checkVersion("PersonAspect", Constants.MAJOR_17, Constants.MINOR_17); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc198TestsJava.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc198.xml"); + } } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java index 3cfc7a149..929b5749d 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/AllTestsAspectJ198.java @@ -29,9 +29,12 @@ public class AllTestsAspectJ198 { suite.addTest(SanityTestsJava17.suite()); suite.addTest(Ajc198TestsJava.suite()); } + // Do not run tests using a previous compiler's preview features anymore. They would all fail. + /* if (LangUtil.is17VMOrGreater() && !LangUtil.is18VMOrGreater()) { suite.addTest(Java17PreviewFeaturesTests.suite()); } + */ return suite; } } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java index 7982ec630..cb3b781bb 100644 --- a/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java +++ b/tests/src/test/java/org/aspectj/systemtest/ajc198/Bugs198Tests.java @@ -21,33 +21,6 @@ public class Bugs198Tests extends XMLBasedAjcTestCase { runTest("ITD annotation with mandatory parameter via aspectpath"); } - public void testAnnotationStyleSpecialIfClauses() { - runTest("annotation style A"); - } - - public void testAnnotationStylePointcutInheritanceWithIfClauses() { - runTest("annotation style B"); - } - - public void testAnnotationStyleSpecialIfClauses2_gh120() { - runTest("annotation style C"); - } - - public void testAnnotationStyleSpecialIfClauses3_gh120() { - runTest("annotation style D"); - } - - public void testAnnotationStyleNegatedIf_gh122() { - runTest("annotation style negated if"); - } - - public void testGitHub_125() { - try (PropertyEnvironment env = ScopedSystemProperties.newPropertyEnvironment()) { - env.setProperty("org.aspectj.weaver.openarchives", "20"); - runTest("compiler can re-open closed JARs"); - } - } - public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Bugs198Tests.class); } diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java new file mode 100644 index 000000000..7040deba4 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Ajc199TestsJava.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc199; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; + +/** + * @author Alexander Kriegisch + */ +public class Ajc199TestsJava extends XMLBasedAjcTestCaseForJava18OrLater { + + public void testDummyJava18() { + runTest("dummy Java 18"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Ajc199TestsJava.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc199.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java new file mode 100644 index 000000000..9cb01eec8 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/AllTestsAspectJ199.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc199; + +import junit.framework.Test; +import junit.framework.TestSuite; +import org.aspectj.util.LangUtil; + +/** + * @author Alexander Kriegisch + */ +public class AllTestsAspectJ199 { + + public static Test suite() { + TestSuite suite = new TestSuite("AspectJ 1.9.9 tests"); + suite.addTest(Bugs199Tests.suite()); + if (LangUtil.is18VMOrGreater()) { + suite.addTest(SanityTestsJava18.suite()); + suite.addTest(Ajc199TestsJava.suite()); + } + if (LangUtil.is18VMOrGreater() && !LangUtil.is19VMOrGreater()) { + suite.addTest(Java18PreviewFeaturesTests.suite()); + } + return suite; + } +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java new file mode 100644 index 000000000..5b2087ed2 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Bugs199Tests.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc199; + +import io.bmuskalla.system.properties.PropertyEnvironment; +import io.bmuskalla.system.properties.ScopedSystemProperties; +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; + +/** + * @author Alexander Kriegisch + */ +public class Bugs199Tests extends XMLBasedAjcTestCase { + + public void testAnnotationStyleSpecialIfClauses() { + runTest("annotation style A"); + } + + public void testAnnotationStylePointcutInheritanceWithIfClauses() { + runTest("annotation style B"); + } + + public void testAnnotationStyleSpecialIfClauses2_gh120() { + runTest("annotation style C"); + } + + public void testAnnotationStyleSpecialIfClauses3_gh120() { + runTest("annotation style D"); + } + + public void testAnnotationStyleNegatedIf_gh122() { + runTest("annotation style negated if"); + } + + public void testCompilerCanReopenClosedJARs_gh125() { + try (PropertyEnvironment env = ScopedSystemProperties.newPropertyEnvironment()) { + env.setProperty("org.aspectj.weaver.openarchives", "20"); + runTest("compiler can re-open closed JARs"); + } + } + + public void testAsyncProceedNestedAroundAdvice_gh128() { + runTest("asynchronous proceed for nested around-advice (@AspectJ)"); + } + + public void testAsyncProceedNestedAroundAdviceThreadPool_gh128() { + // TODO: future improvement, see https://github.com/eclipse/org.aspectj/issues/141 + // runTest("asynchronous proceed for nested around-advice (@AspectJ, thread pool)"); + } + + public void testAsyncProceedNestedAroundAdviceNative_gh128() { + runTest("asynchronous proceed for nested around-advice (native)"); + } + + public void testAsyncProceedNestedAroundAdviceNativeThreadPool_gh128() { + runTest("asynchronous proceed for nested around-advice (native, thread pool)"); + } + + public void testAddExports_gh145() { + runTest("use --add-exports"); + } + + public void testAddReads_gh145() { + runTest("use --add-reads"); + } + + public void testAddModules_gh145() { + runTest("use --add-modules"); + } + + public void testAddModulesJDK_gh145() { + runTest("use --add-modules with non-public JDK module"); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Bugs199Tests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc199.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java new file mode 100644 index 000000000..dbe6f733a --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/Java18PreviewFeaturesTests.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc199; + +import junit.framework.Test; +import org.aspectj.apache.bcel.Constants; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava18Only; + +/** + * @author Alexander Kriegisch + */ +public class Java18PreviewFeaturesTests extends XMLBasedAjcTestCaseForJava18Only { + + public void testSwitchPatternMatchingCaseLabelDominatedByPrecedingError() { + runTest("switch pattern matching error"); + } + + public void testSwitchPatternMatchingJava() { + runTest("switch pattern matching java"); + checkVersion("SwitchPatternOK", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitchPatternMatchingAspect() { + runTest("switch pattern matching aspect"); + checkVersion("SwitchPatternAspect", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Application", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Shape", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + checkVersion("S", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitchPatternMatchingPreview2Error1() { + runTest("switch pattern matching preview 2 error 1"); + } + + public void testSwitchPatternMatchingPreview2Error2() { + runTest("switch pattern matching preview 2 error 2"); + } + + public void testSwitchPatternMatchingPreview2Java() { + runTest("switch pattern matching preview 2 java"); + checkVersion("SwitchPatternPreview2OK", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + } + + public void testSwitchPatternMatchingPreview2Aspect() { + runTest("switch pattern matching preview 2 aspect"); + checkVersion("SwitchPatternPreview2Aspect", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + checkVersion("Application", Constants.MAJOR_18, Constants.PREVIEW_MINOR_VERSION); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(Java18PreviewFeaturesTests.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("ajc199.xml"); + } + +} diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java new file mode 100644 index 000000000..d86e11454 --- /dev/null +++ b/tests/src/test/java/org/aspectj/systemtest/ajc199/SanityTestsJava18.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2021 Contributors + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + *******************************************************************************/ +package org.aspectj.systemtest.ajc199; + +import junit.framework.Test; +import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.testing.XMLBasedAjcTestCaseForJava18OrLater; + +/* + * Some very trivial tests that help verify things are OK. + * These are a copy of the earlier Sanity Tests created for 1.6 but these supply the -17 option + * to check code generation and modification with that version specified. + * + * @author Alexander Kriegisch + */ +public class SanityTestsJava18 extends XMLBasedAjcTestCaseForJava18OrLater { + + public static final int bytecode_version_for_JDK_level = 62; + + // Incredibly trivial test programs that check the compiler works at all (these are easy-ish to debug) + public void testSimpleJava_A() { + runTest("simple - a"); + } + + public void testSimpleJava_B() { + runTest("simple - b"); + } + + public void testSimpleCode_C() { + runTest("simple - c"); + } + + public void testSimpleCode_D() { + runTest("simple - d"); + } + + public void testSimpleCode_E() { + runTest("simple - e"); + } + + public void testSimpleCode_F() { + runTest("simple - f"); + } + + public void testSimpleCode_G() { + runTest("simple - g"); + } + + public void testSimpleCode_H() { + runTest("simple - h", true); + } + + public void testSimpleCode_I() { + runTest("simple - i"); + } + + public void testVersionCorrect1() { + runTest("simple - j"); + checkVersion("A", bytecode_version_for_JDK_level, 0); + } + + public void testVersionCorrect2() { + runTest("simple - k"); + checkVersion("A", bytecode_version_for_JDK_level, 0); + } + + public void testVersionCorrect4() { + runTest("simple - m"); + // Must be 49.0 when -1.5 is specified + checkVersion("A", 49, 0); + } + + public static Test suite() { + return XMLBasedAjcTestCase.loadSuite(SanityTestsJava18.class); + } + + @Override + protected java.net.URL getSpecFile() { + return getClassResource("sanity-tests-18.xml"); + } + +} diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml index 13297309c..37ebfbb85 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc152/ajc152.xml @@ -448,7 +448,7 @@ </run> </ajc-test> - <ajc-test dir="bugs152/pr125480" title="aop.xml aspect inheriting abstract method "> + <ajc-test dir="bugs152/pr125480" title="aop.xml aspect inheriting abstract method"> <compile files="HelloWorld.java"/> <compile files="AbstractMethods.aj, ConcreteMethods.aj" options="-1.5"/> <run class="HelloWorld" ltw="aop-tracing.xml"> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml index 0eb413baa..85bd872b3 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml @@ -95,76 +95,9 @@ </run> </ajc-test> - <!-- Javac/ECJ 9+ compiler option, but belated implementation in AJC 1.9.7 --> + <!-- Javac/ECJ 9+ compiler option, but belated implementation in AJC 1.9.8 --> <ajc-test dir="features198/compiler_release" vm="9" title="compile to older JDK release"> <compile files="Buffers.java" options="--release 8"/> </ajc-test> - <ajc-test dir="bugs198/github_115" title="annotation style A"> - <compile files="A.java" options="-1.5"> - <message kind="warning" line="28" text="advice defined in Azpect has not been applied [Xlint:adviceDidNotMatch]"/> - </compile> - <run class="A"> - <stdout> - <line text="Azpect.before"/> - <line text="A.main"/> - </stdout> - </run> - </ajc-test> - - <ajc-test dir="bugs198/github_115" title="annotation style B"> - <compile files="B.java" options="-1.5"/> - <run class="B"> - <stdout> - <line text="Azpect.before"/> - <line text="B.main"/> - </stdout> - </run> - </ajc-test> - - <ajc-test dir="bugs198/github_120" title="annotation style C"> - <compile files="C.java" options="-1.5"/> - <run class="C"> - <stdout> - <line text="check if() pointcut running on C(1)"/> - <line text="Azpect1.beforeAdvice executing"/> - <line text="C.run() executing"/> - </stdout> - </run> - </ajc-test> - - <ajc-test dir="bugs198/github_120" title="annotation style D"> - <compile files="D.java" options="-1.5"/> - <run class="D"> - <stdout> - <line text="advice running"/> - <line text="D.run() executing"/> - </stdout> - </run> - </ajc-test> - - <ajc-test dir="bugs198/github_122" title="annotation style negated if"> - <compile files="E.java" options="-1.5"/> - <run class="E"> - <stdout> - <line text="advice running"/> - <line text="E.run() executing"/> - </stdout> - </run> - </ajc-test> - - <ajc-test dir="bugs198/github_125" title="compiler can re-open closed JARs"> - <!-- - Here the Java test sets system property org.aspectj.weaver.openarchives to 20 in order to provoke - open JAR limit exhaustion - --> - <compile files="Application.java" options="-1.5" /> - <run class="Application"> - <stdout> - <line text="Before advice"/> - <line text="Hello world!"/> - </stdout> - </run> - </ajc-test> - </suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml new file mode 100644 index 000000000..7c38db68e --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc199/ajc199.xml @@ -0,0 +1,590 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + + +<suite> + + <!-- Java 18 final: no new features, only 2nd preview for "JEP 420: Pattern Matching for switch (Second Preview)" --> + <ajc-test dir="features199/java18" vm="18" title="dummy Java 18"> + </ajc-test> + + <!-- Java ?? final, Java 17, 18 preview --> + <ajc-test dir="features198/java17" vm="18" title="switch pattern matching error"> + <compile files="SwitchPatternError.java" options="--enable-preview -18"> + <!-- TODO: Add correct compiler error message, as soon as JDT Core supports it --> + <message kind="error" file="SwitchPatternError.java" text="This case label is dominated by one of the preceding case label"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 17, 18 preview --> + <ajc-test dir="features198/java17" vm="18" title="switch pattern matching java"> + <compile files="SwitchPatternOK.java" options="--enable-preview -18" /> + <run class="SwitchPatternOK" vmargs="--enable-preview"> + <stdout> + <line text="null" /> + <line text="int 123" /> + <line text="long 999" /> + <line text="double 12.340000" /> + <line text="String foo" /> + <line text="[123, foo, 999, 12.34]" /> + <line text="Non-circle" /> + <line text="Small circle" /> + <line text="Large circle" /> + <line text="Sealed sub-class A" /> + <line text="Sealed sub-class B" /> + <line text="Sealed sub-record C" /> + </stdout> + </run> + </ajc-test> + + <!-- Java ?? final, Java 17, 18 preview --> + <ajc-test dir="features198/java17" vm="18" title="switch pattern matching aspect"> + <compile files="SwitchPatternAspect.aj" options="--enable-preview -18" /> + <run class="Application" vmargs="--enable-preview"> + <stdout> + <line text="null" /> + <line text="int 123" /> + <line text="long 999" /> + <line text="double 12.340000" /> + <line text="String foo" /> + <line text="[123, foo, 999, 12.34]" /> + <line text="Non-circle" /> + <line text="Small circle" /> + <line text="Large circle" /> + <line text="Sealed sub-class A" /> + <line text="Sealed sub-class B" /> + <line text="Sealed sub-record C" /> + </stdout> + </run> + </ajc-test> + + <!-- Java ?? final, Java 17, 18 preview --> + <ajc-test dir="features199/java18" vm="18" title="switch pattern matching preview 2 error 1"> + <compile files="SwitchPatternPreview2Error1.java" options="--enable-preview -18"> + <!-- TODO: Add correct compiler error message, as soon as JDT Core supports it --> + <message kind="error" file="SwitchPatternPreview2Error1.java" text="This case label is dominated by one of the preceding case label"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 17, 18 preview --> + <ajc-test dir="features199/java18" vm="18" title="switch pattern matching preview 2 error 2"> + <compile files="SwitchPatternPreview2Error2.java" options="--enable-preview -18"> + <!-- TODO: Add correct compiler error message, as soon as JDT Core supports it --> + <message kind="error" file="SwitchPatternPreview2Error2.java" text="This case label is dominated by one of the preceding case label"/> + </compile> + </ajc-test> + + <!-- Java ?? final, Java 17, 18 preview --> + <ajc-test dir="features199/java18" vm="18" title="switch pattern matching preview 2 java"> + <compile files="SwitchPatternPreview2OK.java" options="--enable-preview -18" /> + <run class="SwitchPatternPreview2OK" vmargs="--enable-preview"> + <message></message> + <stdout> + <line text="absolute value 1: -1" /> + <line text="other integer: 0" /> + <line text="positive integer: 42" /> + <line text="other integer: -99" /> + <line text="positive integer: 123" /> + <line text="value unavailable: null" /> +<!-- + <line text="null" /> + <line text="int 123" /> + <line text="long 999" /> + <line text="double 12.340000" /> + <line text="String foo" /> + <line text="[123, foo, 999, 12.34]" /> + <line text="Non-circle" /> + <line text="Small circle" /> + <line text="Large circle" /> + <line text="Sealed sub-class A" /> + <line text="Sealed sub-class B" /> + <line text="Sealed sub-record C" /> +--> + </stdout> + </run> + </ajc-test> + + <!-- Java ?? final, Java 17, 18 preview --> + <ajc-test dir="features199/java18" vm="18" title="switch pattern matching preview 2 aspect"> + <compile files="SwitchPatternPreview2Aspect.aj" options="--enable-preview -18" /> + <run class="Application" vmargs="--enable-preview"> + <stdout> + <line text="absolute value 1: -1" /> + <line text="other integer: 0" /> + <line text="positive integer: 42" /> + <line text="other integer: -99" /> + <line text="positive integer: 123" /> + <line text="value unavailable: null" /> +<!-- + <line text="null" /> + <line text="int 123" /> + <line text="long 999" /> + <line text="double 12.340000" /> + <line text="String foo" /> + <line text="[123, foo, 999, 12.34]" /> + <line text="Non-circle" /> + <line text="Small circle" /> + <line text="Large circle" /> + <line text="Sealed sub-class A" /> + <line text="Sealed sub-class B" /> + <line text="Sealed sub-record C" /> +--> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_115" title="annotation style A"> + <compile files="A.java" options="-1.5"> + <message kind="warning" line="28" text="advice defined in Azpect has not been applied [Xlint:adviceDidNotMatch]"/> + </compile> + <run class="A"> + <stdout> + <line text="Azpect.before"/> + <line text="A.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_115" title="annotation style B"> + <compile files="B.java" options="-1.5"/> + <run class="B"> + <stdout> + <line text="Azpect.before"/> + <line text="B.main"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_120" title="annotation style C"> + <compile files="C.java" options="-1.5"/> + <run class="C"> + <stdout> + <line text="check if() pointcut running on C(1)"/> + <line text="Azpect1.beforeAdvice executing"/> + <line text="C.run() executing"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_120" title="annotation style D"> + <compile files="D.java" options="-1.5"/> + <run class="D"> + <stdout> + <line text="advice running"/> + <line text="D.run() executing"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_122" title="annotation style negated if"> + <compile files="E.java" options="-1.5"/> + <run class="E"> + <stdout> + <line text="advice running"/> + <line text="E.run() executing"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_125" title="compiler can re-open closed JARs"> + <!-- + Here the Java test sets system property org.aspectj.weaver.openarchives to 20 in order to provoke + open JAR limit exhaustion + --> + <compile files="Application.java" options="-1.5" /> + <run class="Application"> + <stdout> + <line text="Before advice"/> + <line text="Hello world!"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_128" title="asynchronous proceed for nested around-advice (@AspectJ)"> + <compile files="Application.java MarkerA.java MarkerB.java annotation_syntax/MarkerAAspect.aj annotation_syntax/MarkerBAspect.aj" options="-1.8" /> + <run class="Application" options="1,1"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,1"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + <run class="Application" options="1,2"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,2"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_128" title="asynchronous proceed for nested around-advice (@AspectJ, thread pool)"> + <compile files="Application.java MarkerA.java MarkerB.java annotation_syntax/MarkerAAspect.aj annotation_syntax/MarkerBAspect.aj" options="-1.8" /> + <run class="Application" options="1,1,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,1,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + <run class="Application" options="1,2,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,2,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_128" title="asynchronous proceed for nested around-advice (native)"> + <compile files="Application.java MarkerA.java MarkerB.java native_syntax/MarkerAAspect.aj native_syntax/MarkerBAspect.aj" options="-1.8" /> + <run class="Application" options="1,1"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,1"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + <run class="Application" options="1,2"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,2"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_128" title="asynchronous proceed for nested around-advice (native, thread pool)"> + <compile files="Application.java MarkerA.java MarkerB.java native_syntax/MarkerAAspect.aj native_syntax/MarkerBAspect.aj" options="-1.8" /> + <run class="Application" options="1,1,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,1,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + <run class="Application" options="1,2,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text="<< Outer intercept"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + </stdout> + </run> + <run class="Application" options="2,2,true"> + <stdout ordered="no"> + <line text=">> Outer intercept"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" << Inner intercept"/> + <line text=" << Outer proceed"/> + <line text=" >> Outer proceed"/> + <line text=" >> Inner intercept"/> + <line text=" >> Inner proceed"/> + <line text=" << Inner intercept"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" << Outer proceed"/> + <line text=" >> Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" >> Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text=" Doing something"/> + <line text=" << Inner proceed"/> + <line text="<< Outer intercept"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_145/add_exports" title="use --add-exports" vm="9"> + <compile + files="Application.java" + options="-9 --add-exports java.base/sun.security.x509=ALL-UNNAMED" + /> + <run + class="Application" + vmargs="--add-exports java.base/sun.security.x509=ALL-UNNAMED" + > + <stdout> + <line text="java.security.cert.CertificateParsingException: java.io.IOException"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_145" title="use --add-reads" vm="9"> + <compile + files="add_modules/my.module/module-info.java add_modules/my.module/my/module/Modular.java" + options="-9" + outjar="my.module.jar" + /> + <compile + files="add_reads/other.module/module-info.java add_reads/other.module/other/module/Application.java" + options="-9 --add-reads other.module=my.module --add-exports my.module/my.module=other.module" + modulepath="$sandbox/my.module.jar" + outjar="other.module.jar" + /> + <run + class="other.module.Application" + vmargs="--add-reads other.module=my.module" + modulepath="$sandbox/my.module.jar:$sandbox/other.module.jar" + > + <stdout> + <line text="One modular class can use another one"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_145/add_modules" title="use --add-modules" vm="9"> + <compile + files="my.module/module-info.java my.module/my/module/Modular.java" + options="-9" + outjar="my.module.jar" + /> + <compile + files="NonModular.java" + options="-9 --add-modules my.module --add-exports my.module/my.module=ALL-UNNAMED" + modulepath="$sandbox/my.module.jar" + /> + <run class="NonModular" modulepath="$sandbox/my.module.jar"> + <stdout> + <line text="Non-modular class can use modular one"/> + </stdout> + </run> + </ajc-test> + + <ajc-test dir="bugs199/github_145/add_modules" title="use --add-modules with non-public JDK module" vm="9"> + <!-- + Javac, AJC: no errors. ECJ: "invalid module name: jdk.charsets" + + This is because ECJ does not add internal JDK modules as root modules, but AJC does. This was not so much + intentional in AJC, but simply due to the hacky implementation. Anyway, it works and makes AJC more + Javac-compliant than ECJ, which is nice. + --> + <compile files="UseJDKExtendedCharsets.java" options="-9 --add-modules jdk.charsets --add-exports jdk.charsets/sun.nio.cs.ext=ALL-UNNAMED" /> + <run class="UseJDKExtendedCharsets" vmargs="-ea --add-modules jdk.charsets --add-exports jdk.charsets/sun.nio.cs.ext=ALL-UNNAMED"> + <stdout> + <line text="ISO-2022-JP"/> + </stdout> + </run> + </ajc-test> + +</suite> diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc199/sanity-tests-18.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc199/sanity-tests-18.xml new file mode 100644 index 000000000..30c9660a1 --- /dev/null +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc199/sanity-tests-18.xml @@ -0,0 +1,70 @@ +<!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd"[]> + +<suite> + + <!-- empty class --> + <ajc-test dir="bugs160/simplejava" title="simple - a"> + <compile files="SimpleA.java" options="-18"/> + </ajc-test> + + <!-- class with one method --> + <ajc-test dir="bugs160/simplejava" title="simple - b"> + <compile files="SimpleB.java" options="-18"/> + <run class="SimpleB"/> + </ajc-test> + + <!-- empty aspect --> + <ajc-test dir="bugs160/simplejava" title="simple - c"> + <compile files="SimpleC.java" options="-18"/> + </ajc-test> + + <!-- simple before --> + <ajc-test dir="bugs160/simplejava" title="simple - d"> + <compile files="SimpleD.java" options="-18"/> + </ajc-test> + + <!-- simple itd field --> + <ajc-test dir="bugs160/simplejava" title="simple - e"> + <compile files="SimpleE.java" options="-18"/> + </ajc-test> + + <!-- aspect with main calling a static method --> + <ajc-test dir="bugs160/simplejava" title="simple - f"> + <compile files="SimpleF.java" options="-18"/> + </ajc-test> + + <!-- pertarget --> + <ajc-test dir="bugs160/simplejava" title="simple - g"> + <compile files="SimpleG.java" options="-18"/> + </ajc-test> + + <!-- generic ctor itds --> + <ajc-test dir="bugs160/simplejava" title="simple - h"> + <compile files="SimpleH.java" options="-18"/> + </ajc-test> + + <!-- overriding generic itd methods --> + <ajc-test dir="bugs160/simplejava" title="simple - i"> + <compile files="SimpleI.java" options="-18"/> + </ajc-test> + + <!-- check class file version is 62.0 (Java 18) --> + <ajc-test dir="bugs160/simplejava" title="simple - j"> + <compile files="SimpleJ.java" options="-18"/> + </ajc-test> + + <!-- check class file version is 62.0 (Java 18) --> + <ajc-test dir="bugs160/simplejava" title="simple - k"> + <compile files="SimpleJ.java" options="-source 18"/> + </ajc-test> + + <!-- check class file version is 49.0 --> + <ajc-test dir="bugs160/simplejava" title="simple - m"> + <compile files="SimpleJ.java" options="-1.5"/> + </ajc-test> + + <ajc-test dir="bugs160/simplejava" title="simple - n"> + <compile files="SimpleN.java" options="-18"/> + </ajc-test> + +</suite> diff --git a/util/pom.xml b/util/pom.xml index e02f6255e..ca3e31e75 100644 --- a/util/pom.xml +++ b/util/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>util</artifactId> diff --git a/util/src/main/java/org/aspectj/util/LangUtil.java b/util/src/main/java/org/aspectj/util/LangUtil.java index af1e21d29..7e1c2a253 100644 --- a/util/src/main/java/org/aspectj/util/LangUtil.java +++ b/util/src/main/java/org/aspectj/util/LangUtil.java @@ -194,6 +194,10 @@ public class LangUtil { return 18 <= vmVersion; } + public static boolean is19VMOrGreater() { + return 19 <= vmVersion; + } + /** * Shorthand for "if null, throw IllegalArgumentException" * diff --git a/util/src/main/java/org/aspectj/util/TypeSafeEnum.java b/util/src/main/java/org/aspectj/util/TypeSafeEnum.java index 760c2ef67..fc0de82c9 100644 --- a/util/src/main/java/org/aspectj/util/TypeSafeEnum.java +++ b/util/src/main/java/org/aspectj/util/TypeSafeEnum.java @@ -16,8 +16,8 @@ import java.io.DataOutputStream; import java.io.IOException; public class TypeSafeEnum { - private byte key; - private String name; + private final byte key; + private final String name; public TypeSafeEnum(String name, int key) { this.name = name; @@ -50,7 +50,7 @@ public class TypeSafeEnum { @Override public boolean equals(Object o) { return (o instanceof TypeSafeEnum) && - ((TypeSafeEnum)o).key == key && - ((TypeSafeEnum)o).name.equals(name); + ((TypeSafeEnum)o).key == key && + ((TypeSafeEnum)o).name.equals(name); } } diff --git a/weaver/pom.xml b/weaver/pom.xml index 0e03383a0..966f6791a 100644 --- a/weaver/pom.xml +++ b/weaver/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.aspectj</groupId> <artifactId>aspectj-parent</artifactId> - <version>1.9.9-SNAPSHOT</version> + <version>1.9.10-SNAPSHOT</version> </parent> <artifactId>weaver</artifactId> diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java index 7c4509e71..f498c37c5 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelWorld.java @@ -130,11 +130,13 @@ public class BcelWorld extends World implements Repository { @Override public void reportMatch(ShadowMunger munger, Shadow shadow) { if (getCrossReferenceHandler() != null) { - getCrossReferenceHandler().addCrossReference(munger.getSourceLocation(), // What is being applied - shadow.getSourceLocation(), // Where is it being applied - determineRelKind(munger).getName(), // What kind of advice? - ((Advice) munger).hasDynamicTests() // Is a runtime test being stuffed in the code? - ); + final IRelationship.Kind kind = determineRelKind(munger); + getCrossReferenceHandler().addCrossReference( + munger.getSourceLocation(), // What is being applied? + shadow.getSourceLocation(), // Where is it being applied? + kind == null ? null : kind.getName(), // What kind of advice? + ((Advice) munger).hasDynamicTests() // Is a runtime test being stuffed in the code? + ); } if (!getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) { |