Skip to content

Commit

Permalink
Merge branch 'master' into e423
Browse files Browse the repository at this point in the history
  • Loading branch information
kriegaex committed Sep 8, 2023
2 parents 3a0e84c + c52bcbd commit 39bdd1c
Show file tree
Hide file tree
Showing 80 changed files with 427 additions and 618 deletions.
8 changes: 8 additions & 0 deletions ajc.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Make sure that AJC can compile the project from an IDE like IntelliJ IDEA.
# Caveat: ECJ property must be prefixed by "org.aspectj" for AJC.
# Use "ajc -properties .../org.eclipse.ajdt/ajc.prefs" to activate this config file.
#
# See also:
# https://github.com/eclipse-jdt/eclipse.jdt.core/blob/e53f36cf836b620a316c9c2e321cf7ba6cc78e52/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java#L2649-L2666
# https://github.com/eclipse-aspectj/eclipse.jdt.core/blob/aeeae36048d1615da8e2bf86f6ce4ab1c0011743/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java#L2650-L2667
org.aspectj.org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage=enabled
2 changes: 1 addition & 1 deletion org.aspectj.ajde/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<classpath>
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="classes" sourcepath="source"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion org.aspectj.runtime/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<classpath>
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="classes" sourcepath="source"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion org.aspectj.runtime/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Export-Package: org.aspectj.internal.lang.annotation;version="1.9.20",
org.aspectj.runtime.internal.cflowstack;version="1.9.20",
org.aspectj.runtime.reflect;version="1.9.20"
Eclipse-BundleShape: jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ClassPath: .
Implementation-Version: 1.9.20
Implementation-Vendor: aspectj.org
2 changes: 1 addition & 1 deletion org.aspectj.weaver/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="classes" sourcepath="source"/>
</classpath>
2 changes: 1 addition & 1 deletion org.aspectj.weaver/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Export-Package: org.aspectj.apache.bcel;version="1.9.20",
org.aspectj.weaver.reflect;version="1.9.20",
org.aspectj.weaver.tools;version="1.9.20"
Eclipse-BundleShape: jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ClassPath: .
Implementation-Version: 1.9.20
Implementation-Vendor: aspectj.org
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ boolean zapped() {
}


private class MockCoreCompilerConfiguration extends CoreCompilerConfiguration {
private static class MockCoreCompilerConfiguration extends CoreCompilerConfiguration {

boolean iGotFlushed = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
* Copyright (c) 2010 SprinSource and others.
* All rights reserved. This program and the accompanying materials
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* Andrew Eisenberg - initial version
*******************************************************************************/
Expand All @@ -29,25 +29,25 @@

/**
* Tests for mapping between IProgramElement and IJavaElements
*
*
* This class tests that aj references across projects are working
*/
public class MultipleProjectModelTests extends AJDTCoreTestCase {

private IJavaProject commons;
private IJavaProject dependent;
private AJProjectModelFacade model;

@Override
protected void setUp() throws Exception {
super.setUp();
commons = JavaCore.create(createPredefinedProject("DefaultEmptyProject"));
dependent = JavaCore.create(createPredefinedProject("DefaultEmptyProjectDependent"));
model = AJProjectModelFactory.getInstance().getModelForJavaElement(dependent);
}

public void testITDFieldInOtherProject() throws Exception {
ICompilationUnit other = createCompilationUnitAndPackage("common", "Aspect.aj",
ICompilationUnit other = createCompilationUnitAndPackage("common", "Aspect.aj",
"package common;\n" +
"public aspect Aspect {\n" +
" public int ITD.x;\n" +
Expand All @@ -57,7 +57,7 @@ public void testITDFieldInOtherProject() throws Exception {
" interface ITD { }\n" +
" public @interface Foo{ }" +
"}", commons);
ICompilationUnit unit = createCompilationUnitAndPackage("dependent", "Java.java",
ICompilationUnit unit = createCompilationUnitAndPackage("dependent", "Java.java",
"package dependent;\n" +
"public class Java {\n" +
"}", dependent);
Expand All @@ -66,7 +66,7 @@ public void testITDFieldInOtherProject() throws Exception {
assertNoProblems(dependent.getProject());
IType type = unit.getType("Java");
IType otherType = other.getType("Aspect");

List<IJavaElement> elts = model.getRelationshipsForElement(type, AJRelationshipManager.ASPECT_DECLARATIONS);

// the ITDs + the declare statement
Expand All @@ -88,17 +88,17 @@ public void testITDFieldInOtherProject() throws Exception {
private void roundTripCheck(IType otherType, IJavaElement orig) throws JavaModelException {
assertTrue("Should exist: " + orig.getHandleIdentifier(), orig.exists());
assertEquals(otherType, orig.getParent());
assertTrue("" + orig + " should be a child of " + otherType, isAChildOf(otherType, orig));
assertTrue(orig + " should be a child of " + otherType, isAChildOf(otherType, orig));

IProgramElement ipe = model.javaElementToProgramElement(orig);
assertNotSame(IHierarchy.NO_STRUCTURE, ipe);

orig = model.programElementToJavaElement(ipe);
assertTrue("Should exist: " + orig.getHandleIdentifier(), orig.exists());
assertEquals(otherType, orig.getParent());
assertTrue("" + orig + " should be a child of " + otherType, isAChildOf(otherType, orig));
assertTrue(orig + " should be a child of " + otherType, isAChildOf(otherType, orig));
}

private boolean isAChildOf(IParent parent, IJavaElement maybeChild) throws JavaModelException {
IJavaElement[] children = parent.getChildren();
for (IJavaElement child : children) {
Expand All @@ -108,4 +108,4 @@ private boolean isAChildOf(IParent parent, IJavaElement maybeChild) throws JavaM
}
return false;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion org.eclipse.ajdt.core.tests/workspace/Bug282948/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion org.eclipse.ajdt.core.tests/workspace/Bug283468/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion org.eclipse.ajdt.core.tests/workspace/Bug284358/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion org.eclipse.ajdt.core.tests/workspace/Bug295249/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 1 addition & 1 deletion org.eclipse.ajdt.core.tests/workspace/Bug298683/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="bin3" path="src3"/>
<classpathentry kind="src" output="bin2" path="src2"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public AJBuilder() {
/* (non-Javadoc)
* @see org.eclipse.core.resources.IncrementalProjectBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
*/
protected IProject[] build(int kind, Map args, IProgressMonitor progressMonitor) throws CoreException {
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor progressMonitor) throws CoreException {
IProject project = getProject();
AjCompiler compiler = AspectJPlugin.getDefault().getCompilerFactory().getCompilerForProject(project);

Expand Down Expand Up @@ -457,10 +457,10 @@ public void run() {
return participants;
}

private void augmentAspectPath(IProject project, Map args) {
private void augmentAspectPath(IProject project, Map<String, String> args) {
if (args.containsKey("aspectPath")) {
AJLog.logStart("Augmenting aspect path with args from builder");
String toAugment = (String) args.get("aspectPath");
String toAugment = args.get("aspectPath");
String[] toAugmentArr = toAugment.split(",");
for (int i = 0; i < toAugmentArr.length; i++) {
toAugmentArr[i] = toAugmentArr[i].trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ else if (name.equals("src.excludes")) { //$NON-NLS-1$
}
IPath[] exclusionPatterns = new IPath[exclusions.size()];
for (int j = 0; j < exclusionPatterns.length; j++) {
String exclusionPathStr = (String) exclusions.get(j);
String exclusionPathStr = exclusions.get(j);
if (exclusionPathStr.startsWith(srcFolder)) {
exclusionPathStr = exclusionPathStr.substring(srcFolder.length());
}
Expand All @@ -206,7 +206,7 @@ else if (name.equals("src.excludes")) { //$NON-NLS-1$
}
IPath[] inclusionPatterns = new IPath[inclusions.size()];
for (int j = 0; j < inclusionPatterns.length; j++) {
String inclusionPathStr = (String) inclusions.get(j);
String inclusionPathStr = inclusions.get(j);
if (inclusionPathStr.startsWith(srcFolder)) {
inclusionPathStr = inclusionPathStr.substring(srcFolder.length());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,7 @@ protected String getSeparatorString(int nodeIndex) {

String lineDelim= getLineDelimiter();
StringBuilder buf= new StringBuilder(lineDelim);
for (int i= 0; i < newLines; i++) {
buf.append(lineDelim);
}
buf.append(lineDelim.repeat(Math.max(0, newLines)));
buf.append(createIndentString(getNodeIndent(nodeIndex + 1)));
return buf.toString();
}
Expand Down Expand Up @@ -955,9 +953,7 @@ private int rewriteParagraphList(ASTNode parent, StructuralPropertyDescriptor pr
ParagraphListRewriter listRewriter= new ParagraphListRewriter(insertIndent, separator);
StringBuilder leadString= new StringBuilder();
if (isAllOfKind(events, RewriteEvent.INSERTED)) {
for (int i= 0; i < lead; i++) {
leadString.append(getLineDelimiter());
}
leadString.append(String.valueOf(getLineDelimiter()).repeat(Math.max(0, lead)));
leadString.append(createIndentString(insertIndent));
}
return listRewriter.rewriteList(parent, property, insertPos, leadString.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


import java.util.List;
import java.util.Objects;

import org.aspectj.asm.IProgramElement.Accessibility;
import org.aspectj.asm.IProgramElement.ExtraInformation;
Expand Down Expand Up @@ -46,11 +47,7 @@ public class AspectJMemberElement extends NamedMember implements IMethod, IAspec

public AspectJMemberElement(JavaElement parent, String name, String[] parameterTypes) {
super(parent, name);
if (parameterTypes == null) {
fParameterTypes= fgEmptyList;
} else {
fParameterTypes= parameterTypes;
}
fParameterTypes = Objects.requireNonNullElse(parameterTypes, fgEmptyList);
}

/* (non-Javadoc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package org.eclipse.ajdt.core.javaelements;

import java.util.List;
import java.util.Objects;

import org.aspectj.asm.IProgramElement.Modifiers;
import org.aspectj.asm.IProgramElement.Accessibility;
Expand Down Expand Up @@ -178,11 +179,7 @@ public char[] getReturnTypeName() {
}

public void setAnnotations(IAnnotation[] annotations) {
if (annotations == null) {
this.annotations = Annotation.NO_ANNOTATIONS;
} else {
this.annotations = annotations;
}
this.annotations = Objects.requireNonNullElse(annotations, Annotation.NO_ANNOTATIONS);
}

public void setArguments(ILocalVariable[] arguments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected Object createElementInfo() {
List<String> typesConverted = new ArrayList<>(types.size());
for (String parentTypeName : types) {

parentTypeName = parentTypeName.replaceAll("\\$", "\\.");
parentTypeName = parentTypeName.replaceAll("\\$", ".");
typesConverted.add(parentTypeName);
}
elementInfo.setTypes(typesConverted.toArray(new String[0]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public Object getElementInfo() throws JavaModelException {
return info;
}
}
private final class ITIT extends SourceType {
private static final class ITIT extends SourceType {
final Object info;
private ITIT(JavaElement parent, IType actualType, IProgramElement ajElement) throws JavaModelException {
super(parent, actualType.getElementName());
Expand Down
Loading

0 comments on commit 39bdd1c

Please sign in to comment.