Skip to content

Commit

Permalink
Merge pull request #20 from jGauravGupta/FISH-1282
Browse files Browse the repository at this point in the history
FISH-1282 Jakarta EE9: Fixes HK2 OSGI issues on starting the Payara Server
  • Loading branch information
jGauravGupta authored Apr 16, 2021
2 parents 960ac1f + ec0e91d commit 84cd5da
Show file tree
Hide file tree
Showing 80 changed files with 127 additions and 76 deletions.
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-bom</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
<packaging>pom</packaging>

<name>HK2 Bom Pom</name>
Expand Down
2 changes: 1 addition & 1 deletion class-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<groupId>org.glassfish.hk2</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public interface MethodModel extends Member, AnnotatedElement {
*/
String[] getArgumentTypes();

/**
* @return the checked exception types, or an empty array if the method doesn't
* declare any thrown exceptions
*/
String[] getExceptionTypes();

/**
* Returns the list of parameter
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
public class MethodModelImpl extends AnnotatedElementImpl implements MethodModel {

private List<Parameter> parameters;
private List<ParameterizedType> exceptionTypes;
private ParameterizedType returnType;
final ExtensibleType<?> owner;
private final String signature;
Expand Down Expand Up @@ -74,6 +75,24 @@ public String[] getArgumentTypes() {
return stringTypes;
}

@Override
public String[] getExceptionTypes() {
String[] stringTypes;
if (exceptionTypes != null) {
stringTypes = new String[exceptionTypes.size()];
for (int i = 0; i < exceptionTypes.size(); i++) {
stringTypes[i] = exceptionTypes.get(i).getTypeName();
}
} else {
stringTypes = new String[0];
}
return stringTypes;
}

public void setExceptionTypes(List<ParameterizedType> exceptionTypes) {
this.exceptionTypes = exceptionTypes;
}

@Override
public List<Parameter> getParameters() {
return parameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class MethodSignatureVisitorImpl extends SignatureVisitor {
private final MethodModel methodModel;

private final List<Parameter> parameters = new ArrayList<>();
private final List<ParameterizedType> exceptionTypes = new ArrayList<>();
private final ParameterizedType returnType = new ParameterizedTypeImpl();
private final ArrayDeque<ParameterizedType> parentType = new ArrayDeque<>();

Expand All @@ -49,6 +50,10 @@ public List<Parameter> getParameters() {
return parameters;
}

public List<ParameterizedType> getExceptionTypes() {
return exceptionTypes;
}

public ParameterizedType getReturnType() {
return returnType;
}
Expand All @@ -61,6 +66,11 @@ public SignatureVisitor visitParameterType() {
return this;
}

@Override
public SignatureVisitor visitExceptionType() {
return this;
}

@Override
public SignatureVisitor visitReturnType() {
parentType.add(returnType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,17 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
org.objectweb.asm.Type type = org.objectweb.asm.Type.getReturnType(desc);
returnType.setType(type);

final List<ParameterizedType> exceptionTypes = new ArrayList<>();
if (exceptions != null) {
for (int i = 0; i < exceptions.length; i++) {
final String exception = exceptions[i];
final ParameterizedTypeImpl exceptionType = new ParameterizedTypeImpl(exception);
exceptionType.setType(org.objectweb.asm.Type.getObjectType(exception));
exceptionTypes.add(exceptionType);
}
}
methodModel.setExceptionTypes(exceptionTypes);

org.objectweb.asm.Type[] types = org.objectweb.asm.Type.getArgumentTypes(desc);
for (int i = 0; i < methodModel.getParameters().size(); i++) {
ParameterImpl parameter = (ParameterImpl) methodModel.getParameter(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ public void simpleTest() throws IOException, InterruptedException {
Assert.assertEquals("yellow", gradientColor2.get(0).getValues().get("name"));
Assert.assertEquals("orange", gradientColor2.get(1).getValues().get("name"));

// Exception types
final String[] exceptionTypes = mm.getExceptionTypes();
Assert.assertEquals(1, exceptionTypes.length);
Assert.assertEquals(IllegalArgumentException.class.getName(), exceptionTypes[0]);

// Parameter annotations, type and generic types check
Assert.assertEquals(5, mm.getParameters().size());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public SampleType<Integer, Character, Boolean> setFoo(
List<String> input,
SampleType<Double, String, SampleType<Short, Float, Long>> sampleType,
int count,
Object value) {
Object value) throws IllegalArgumentException {
return null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/caching/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/caching/runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>caching-aop-example</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>caching-aop-example-runner</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/caching/system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>caching-aop-example</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>caching-aop-example-system</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/configuration/webserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>configuration-examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>webserver-configuration-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/configuration/xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>configuration-examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>xml-configuration-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-resolver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>custom-resolver-example</artifactId>
<name>Custom Resolver Example</name>
Expand Down
2 changes: 1 addition & 1 deletion examples/events/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/events/threaded/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>event-examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>threading-event-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/operations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>operations-example</artifactId>
<name>Operations Example</name>
Expand Down
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/security-lockdown/alice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>security-lockdown-example</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>security-lockdown-example-alice</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/security-lockdown/mallory/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>security-lockdown-example</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>security-lockdown-example-mallory</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/security-lockdown/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>examples</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion examples/security-lockdown/runner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>security-lockdown-example</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>security-lockdown-example-runner</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion examples/security-lockdown/system/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>security-lockdown-example</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>security-lockdown-example-system</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion external/aopalliance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>external</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>aopalliance-repackaged</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion external/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion guice-bridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>guice-bridge</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hk2-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/hk2-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-configuration</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>hk2-configuration-integration</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-configuration</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>

<artifactId>hk2-configuration-hub</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/persistence/hk2-xml/hk2-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-xml-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>hk2-json</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/persistence/hk2-xml/hk2-pbuf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-xml-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>hk2-pbuf</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-xml-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>hk2-xml-integration-test</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/persistence/hk2-xml/main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-xml-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>hk2-xml</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/persistence/hk2-xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-configuration-persistence</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/persistence/hk2-xml/schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-xml-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>hk2-xml-schema</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion hk2-configuration/persistence/hk2-xml/test1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-xml-parent</artifactId>
<version>3.0.1</version>
<version>3.0.1.payara-p1</version>
</parent>
<artifactId>hk2-xml-test</artifactId>

Expand Down
Loading

0 comments on commit 84cd5da

Please sign in to comment.