[BUG] Regression with location: ANNOTATION in java provider, not seeing rule match #620
Open
1 task done
Labels
kind/bug
Categorizes issue or PR as related to a bug.
priority/critical-urgent
Highest priority. Must be actively worked on as someone's top priority right now.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
Is there an existing issue for this?
Konveyor version
Latest as of June 13 2024
Priority
Undefined (Default)
Current Behavior
We noticed a regression where a custom rule that used to match no longer does.
Below is the information
Source file, using an '@Remote'
src/main/java/org/jboss/as/quickstarts/ejb/remote/stateful/CounterBean.java
Link to custom rule
Link to full output.yaml
We originally suspected this may be related to the sample app having 2 different modules in it for client and server-side. I ran Kantra against those individual modules, i.e. ran against the 'server-side' module, and I still did not see the custom rule for the Remote annotation match.
At this point, I think the issue may be related to the ANNOTATION location.
Expected Behavior
Assume we'd have a match like this:
[](- name: kai/quarkus
description: Quarkus focused rules to help migrate from Java EE
violations:
remote-ejb-to-quarkus-00000:
description: Remote EJBs are not supported in Quarkus
category: mandatory
labels:
- konveyor.io/source=jakarta-ee
- konveyor.io/source=java-ee
- konveyor.io/target=quarkus
incidents:
- uri: file:///tmp/source-code/server-side/src/main/java/org/jboss/as/quickstarts/ejb/remote/stateful/CounterBean.java
message: "Remote EJBs are not supported in Quarkus, and therefore its use must be removed and replaced with REST functionality. In order to do this:\n 1. Replace the
@Remote
annotation on the class with a@jakarta.ws.rs.Path(\"<endpoint>\")
annotation. An endpoint must be added to the annotation in place of<endpoint>
to specify the actual path to the REST service.\n 2. Remove@Stateless
annotations if present. Given that REST services are stateless by nature, it makes it unnecessary.\n 3. For every public method on the EJB being converted, do the following:\n - Annotate the method with@jakarta.ws.rs.GET
\n - Annotate the method with@jakarta.ws.rs.Path(\"<endpoint>\")
and give it a proper endpoint path. As a rule of thumb, the method name can be used as endpoint, for instance:\n\n @Path(\"/increment\")\n public void increment() \n
\n - Add@jakarta.ws.rs.QueryParam(\"<param-name>\")
to any method parameters if needed, where<param-name>
is a name for the parameter."codeSnip: " 1 /*\n 2 * JBoss, Home of Professional Open Source\n 3 * Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual\n 4 * contributors by the @authors tag. See the copyright.txt in the\n 5 * distribution for a full listing of individual contributors.\n 6 *\n 7 * Licensed under the Apache License, Version 2.0 (the "License");\n 8 * you may not use this file except in compliance with the License.\n 9 * You may obtain a copy of the License at\n 10 * http://www.apache.org/licenses/LICENSE-2.0\n 11 * Unless required by applicable law or agreed to in writing, software\n 12 * distributed under the License is distributed on an "AS IS" BASIS,\n 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n 14 * See the License for the specific language governing permissions and\n 15 * limitations under the License.\n 16 */\n 17 package org.jboss.as.quickstarts.ejb.remote.stateful;\n 18 \n 19 import javax.ejb.Remote;\n 20 import javax.ejb.Stateful;\n 21 \n 22 /\n 23 * @author Jaikiran Pai\n 24 /\n 25 @stateful\n 26 @Remote(RemoteCounter.class)\n 27 public class CounterBean implements RemoteCounter {\n 28 \n 29 private int count = 0;\n 30 \n 31 @OverRide\n 32 public void increment() {\n 33 this.count++;\n 34 }\n 35 \n 36 @OverRide\n 37 public void decrement() {\n 38 this.count--;\n 39 }\n 40 \n 41 @OverRide\n 42 public int getCount() {\n 43 return this.count;\n 44 }\n 45 }\n"
lineNumber: 26
variables:
file: file:///tmp/source-code/server-side/src/main/java/org/jboss/as/quickstarts/ejb/remote/stateful/CounterBean.java
kind: Class
name: Stateful
package: org.jboss.as.quickstarts.ejb.remote.stateful
- uri: file:///tmp/source-code/server-side/src/main/java/org/jboss/as/quickstarts/ejb/remote/stateless/CalculatorBean.java
message: "Remote EJBs are not supported in Quarkus, and therefore its use must be removed and replaced with REST functionality. In order to do this:\n 1. Replace the
@Remote
annotation on the class with a@jakarta.ws.rs.Path(\"<endpoint>\")
annotation. An endpoint must be added to the annotation in place of<endpoint>
to specify the actual path to the REST service.\n 2. Remove@Stateless
annotations if present. Given that REST services are stateless by nature, it makes it unnecessary.\n 3. For every public method on the EJB being converted, do the following:\n - Annotate the method with@jakarta.ws.rs.GET
\n - Annotate the method with@jakarta.ws.rs.Path(\"<endpoint>\")
and give it a proper endpoint path. As a rule of thumb, the method name can be used as endpoint, for instance:\n\n @Path(\"/increment\")\n public void increment() \n
\n - Add@jakarta.ws.rs.QueryParam(\"<param-name>\")
to any method parameters if needed, where<param-name>
is a name for the parameter."codeSnip: " 1 /\n 2 * JBoss, Home of Professional Open Source\n 3 * Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual\n 4 * contributors by the @authors tag. See the copyright.txt in the\n 5 * distribution for a full listing of individual contributors.\n 6 *\n 7 * Licensed under the Apache License, Version 2.0 (the "License");\n 8 * you may not use this file except in compliance with the License.\n 9 * You may obtain a copy of the License at\n 10 * http://www.apache.org/licenses/LICENSE-2.0\n 11 * Unless required by applicable law or agreed to in writing, software\n 12 * distributed under the License is distributed on an "AS IS" BASIS,\n 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n 14 * See the License for the specific language governing permissions and\n 15 * limitations under the License.\n 16 */\n 17 package org.jboss.as.quickstarts.ejb.remote.stateless;\n 18 \n 19 import javax.ejb.Remote;\n 20 import javax.ejb.Stateless;\n 21 \n 22 /\n 23 * @author Jaikiran Pai\n 24 */\n 25 @stateless\n 26 @Remote(RemoteCalculator.class)\n 27 public class CalculatorBean implements RemoteCalculator {\n 28 \n 29 @OverRide\n 30 public int add(int a, int b) {\n 31 return a + b;\n 32 }\n 33 \n 34 @OverRide\n 35 public int subtract(int a, int b) {\n 36 return a - b;\n 37 }\n 38 }\n"
lineNumber: 26
variables:
file: file:///tmp/source-code/server-side/src/main/java/org/jboss/as/quickstarts/ejb/remote/stateless/CalculatorBean.java
kind: Class
name: Stateless
package: org.jboss.as.quickstarts.ejb.remote.stateless
links:
- url: https://jakarta.ee/specifications/restful-ws/
title: Jakarta RESTful Web Services
effort: 1)
How Reproducible
Always (Default)
Steps To Reproduce
I have a short reproducer here: https://github.com/jwmatthews/issue_reproducers/tree/main/kantra/ejb_remote
You can find the referenced custom rule at: https://github.com/jwmatthews/issue_reproducers/blob/main/kantra/ejb_remote/custom_rules/03-remote-ejb-to-quarkus.windup.yaml
Environment
Anything else?
This appears to be a regression as we saw matches for this rule + sample application about 3 months ago, here is an example we checked in from an older notebook example.
https://github.com/konveyor-ecosystem/kai/blob/main/notebooks/ejb_remote/analysis_report/ejb-remote/output.yaml#L1278
This is related to an issue we are tracking in kai: konveyor/kai#204
There is another open issue on java.referenced location ANNOTATION, don't think it's related, but will link for awareness:
#508
The text was updated successfully, but these errors were encountered: