Skip to content

Commit

Permalink
Remove dependency on jakarta.annotation-api
Browse files Browse the repository at this point in the history
We only used this for the Generated anno, for generated code, and
for the Resource anno in one test. Removed use of Generated and
switched use of Resource to use Deprecated (for a test of Java
integration with annotations).
  • Loading branch information
headius committed Jan 22, 2025
1 parent 74bc2bb commit f0f7767
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 30 deletions.
2 changes: 0 additions & 2 deletions core/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@

jar 'com.headius:backport9:1.13'

jar 'jakarta.annotation:jakarta.annotation-api:2.0.0', scope: 'provided'

jar 'org.crac:crac:1.5.0'

plugin_management do
Expand Down
6 changes: 0 additions & 6 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,6 @@ DO NOT MODIFY - GENERATED CODE
<artifactId>backport9</artifactId>
<version>1.13</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.crac</groupId>
<artifactId>crac</artifactId>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/org/jruby/anno/AnnotationBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ public void processType(TypeElement cd) {
out.println("import org.jruby.runtime.MethodIndex;");
out.println("import java.util.Arrays;");
out.println("import java.util.List;");
out.println("import jakarta.annotation.Generated;");
out.println("");
out.println("@Generated(\"org.jruby.anno.AnnotationBinder\")");
out.println("@SuppressWarnings(\"deprecation\")");
out.println("public class " + qualifiedName + POPULATOR_SUFFIX + " extends TypePopulator {");
out.println(" public void populate(RubyModule cls, Class clazz) {");
Expand Down
3 changes: 0 additions & 3 deletions core/src/main/java/org/jruby/anno/IndyBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Method;

import jakarta.annotation.Generated;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
Expand Down Expand Up @@ -130,8 +129,6 @@ public void processType(TypeElement cd) {

ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);

cw.visitAnnotation(p(Generated.class), true);

cw.visit(Opcodes.V1_8, ACC_PUBLIC, ("org.jruby.gen." + qualifiedName + POPULATOR_SUFFIX).replace('.', '/'), null, "org/jruby/anno/TypePopulator", null);

mv = new SkinnyMethodAdapter(cw, ACC_PUBLIC, "<init>", "()V", null, null);
Expand Down
2 changes: 1 addition & 1 deletion maven/jruby-complete/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
'Bundle-Description' => 'JRuby ${project.version} OSGi bundle',
'Bundle-SymbolicName' => 'org.jruby.jruby',
# the artifactId exclusion needs to match the jruby-core from above
'Embed-Dependency' => '*;type=jar;scope=provided;inline=true;artifactId=!jnr-ffi|jitescript|jakarta.annotation-api',
'Embed-Dependency' => '*;type=jar;scope=provided;inline=true;artifactId=!jnr-ffi|jitescript',
'Embed-Transitive' => true
} ) do
# TODO fix DSL
Expand Down
6 changes: 2 additions & 4 deletions spec/java_integration/fixtures/EveryTypeAnnotations.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
import java.util.List;
import java.util.Map;

import jakarta.annotation.Resource;

public class EveryTypeAnnotations {
@Retention(RUNTIME)
@Target({ TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE, ANNOTATION_TYPE, PACKAGE, TYPE_PARAMETER,
Expand All @@ -69,7 +67,7 @@ public class EveryTypeAnnotations {
char achar() default 0;
RetentionPolicy anenum() default RetentionPolicy.CLASS;
Class<?> aClass() default java.lang.Object.class;
Resource[] Darray() default {};
Deprecated[] Darray() default {};
}

public static Map<String, List<Object>> decodeAnnotatedMethods(Class cls) {
Expand All @@ -93,7 +91,7 @@ public static Map<String, List<Object>> decodeAnnotatedMethods(Class cls) {
char achar = annotation.achar();
RetentionPolicy anenum = annotation.anenum();
Class<?> aClass = annotation.aClass();
Resource[] Darray = annotation.Darray();
Deprecated[] Darray = annotation.Darray();


decoded.put(method.getName(), Arrays.asList(astr, abyte, ashort, anint, along, afloat, adouble, abool, anbool, achar, anenum, aClass, Darray));
Expand Down
4 changes: 2 additions & 2 deletions spec/java_integration/reify/annos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ClassWithAnnotatedMethods3
"astr=\"Hello\", abyte=0xde, ashort=0xEF_FF, anint=0xFFff_EeeE, along=0xFFFF_EEEE_0000_9999,"+
"afloat=3.5, adouble=1024.1024, abool=true, anbool=false, achar='?',"+
"anenum=java.lang.annotation.RetentionPolicy.RUNTIME, aClass=java.lang.String.java_class,"+
"Darray={@jakarta.annotation.Resource(description=\"first\"), @jakarta.annotation.Resource(description=\"second\")})"+
"Darray={@java.lang.Deprecated(since=\"first\"), @java.lang.Deprecated(since=\"second\")})"+
" void foo()")
def foo; end

Expand Down Expand Up @@ -103,7 +103,7 @@ def baz; end
arry = output[-1]
expect(easy_out).to eq(["Hello", -34, -4097,-4370, -18769007044199, 3.5, 1024.1024,true, false,'?'.ord, java.lang.annotation.RetentionPolicy::RUNTIME, java.lang.String.java_class.to_java])
expect(arry).to_not be_nil
expect(arry.map &:description).to eq(%w{first second})
expect(arry.map &:since).to eq(%w{first second})
end

it "has signed base10-set values" do
Expand Down
4 changes: 2 additions & 2 deletions spec/java_integration/types/classgen_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class JavaProxyClassWithAnnotatedMethods < java.io.FilterReader
"astr=\"Hello\", abyte=0xde, ashort=0xEF_FF, anint=0xFFff_EeeE, along=0xFFFF_EEEE_0000_9999,"+
"afloat=3.5, adouble=1024.1024, abool=true, anbool=false, achar='?',"+
"anenum=java.lang.annotation.RetentionPolicy.RUNTIME, aClass=java.lang.String.java_class,"+
"Darray={@jakarta.annotation.Resource(description=\"first\"), @jakarta.annotation.Resource(description=\"second\")})"+
"Darray={@java.lang.Deprecated(since=\"first\"), @java.lang.Deprecated(since=\"second\")})"+
" void foo()")
def foo; end

Expand All @@ -158,7 +158,7 @@ def foo; end
arry = output[-1]
expect(easy_out).to eq(["Hello", -34, -4097,-4370, -18769007044199, 3.5, 1024.1024,true, false,'?'.ord, java.lang.annotation.RetentionPolicy::RUNTIME, java.lang.String.java_class.to_java])
expect(arry).to_not be_nil
expect(arry.map &:description).to eq(%w{first second})
expect(arry.map &:since).to eq(%w{first second})
end
end

Expand Down
8 changes: 0 additions & 8 deletions test/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

scope :test do
jar 'junit:junit:4.11'
jar 'jakarta.annotation:jakarta.annotation-api:2.0.0'
jar 'commons-logging:commons-logging:1.1.3'
jar 'org.livetribe:livetribe-jsr223:2.0.7'
jar 'org.jruby:jruby-core', '${project.version}'
Expand Down Expand Up @@ -83,13 +82,6 @@
'overWrite' => 'false',
'outputDirectory' => 'target',
'destFileName' => 'junit.jar' },
{ 'groupId' => 'jakarta.annotation',
'artifactId' => 'jakarta.annotation-api',
'version' => '2.0.0',
'type' => 'jar',
'overWrite' => 'false',
'outputDirectory' => 'target',
'destFileName' => 'annotation-api.jar' },
{ 'groupId' => 'com.googlecode.jarjar',
'artifactId' => 'jarjar',
'version' => '1.1',
Expand Down

0 comments on commit f0f7767

Please sign in to comment.