Kotlin compilation error: unresolved AspectJ supertype - interop

I'm trying to use a Java library in my Kotlin project.
Creating variables in my project of types defined in the library works fine, e.g. val foo: Foo = fooProvider.get(), but introducing code that actually uses these types, e.g. foo.toString(), causes a compilation error:
Error:Kotlin: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class com.example.Foo, unresolved supertypes: ajcMightHaveAspect
From what I have found so far my example Foo type implements ajcMightHaveAspect which is some type of AspectJ interface.
aspectjrt is on my classpath but I cannot find ajcMightHaveAspect defined anywhere.
Is this a Kotlin compiler bug? Am I doing something wrong?

Problem was fixed in AspectJ.
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=493554 for more details .
Hope it will help.

Related

How to get runtime classpath in gradle kts script?

In gradle script I can do sourceSets.main.runtimeClasspath to get the runtime classpath. But in kts script it complains
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val NamedDomainObjectContainer<Configuration>.runtimeClasspath: NamedDomainObjectProvider<Configuration> defined in org.gradle.kotlin.dsl
How can I do it in kts script?
It turns out that I need sourceSets["main"].runtimeClasspath . Not sure if it is the most idiomatic way

Specifying plugin class in bytebuddy gradle plugin

I have updated ByteBuddy Gradle plugin to the version 1.11.18.
Unlikely the previous version, where I could set up byteBuddy.transform.plugin as a string, in the latest version I have to set it up as a class.
Cannot cast object 'com.test.PluginImpl.class' with class 'java.lang.String' to class 'java.lang.Class' due to: java.lang.ClassNotFoundException: com.test.PluginImpl.class
I'm trying to figure out how to get the plugin applied
I followed the readme (https://github.com/raphw/byte-buddy/tree/master/byte-buddy-gradle-plugin#buildgradle):
byteBuddy {
transformation {
plugin = com.test.PluginImpl.class
}
}
However, I've got the error:
* What went wrong:
A problem occurred evaluating root project 'Test'.
> Could not get unknown property 'com' for object of type net.bytebuddy.build.gradle.Transformation.
Did you add the plugin to the buildsource? Groovy is a bit guessy when it comes to these things. Also try importing the class and using the unqualified name.
The old approach did no longer work properly with newer Gradle versions which is why I had to redo it.

Exception in compiling groovy & java using maven

My groovy file contains:
#Grapes([
#Grab('org.codehaus.groovy.modules.http-builder:http-builder:0.7'),
#Grab('org.apache.httpcomponents:httpmime:4.5.1')
])
.......code
I am trying to compile groovy and java code. But I am getting below error:
java.lang.RuntimeException: Transform groovy.grape.GrabAnnotationTransformation#69bda33a cannot be run
This works for me, note that I did change HttpBuilder to v.0.7.1:
#Grapes([
#Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1'),
#Grab(group='org.apache.httpcomponents', module='httpmime', version='4.5.1')
])
Likely way too late for you to care, but I saw the same error just now.
I suspect the problem is that the #Grab annotation can't take effect because Maven is controlling the dependencies, or perhaps because Maven is trying to compile both Groovy and Java code, and the class loader created by the #Grab annotation can't influence the Java code.
Upshot is, I suspect you (and I) need to move the dependency out of the Groovy class in question, and put it into the pom.xml file Maven is using.

RoleGroupAOImpl1Client.java:3: error: cannot find symbol import com.shaic.framework.service.org.CreateRoleGroup;

RoleGroupAOImpl1Client.java:3: error: cannot find symbol import
com.shaic.framework.service.org.CreateRoleGroup;
I'm getting this error while building, can anyone help me?
your code does not compile, probably because of a missing dependency - the one that has the CreateRoleGroup class. Since it looks like an internal class, you might need to check if it is properly packaged (in a jar) and uploaded to the repository you use.

javax.el.ELContext cannot be resolved error when adding FaceletContext jsf maven built

I have this error when I added those lines in one method of managed bean :
I fixed the imports of my project but no result
I use maven spring jsf and hibernate
here is the error :
Unresolved compilation problem: The type javax.el.ELContext cannot be resolved. It is indirectly referenced from required .class files
here the lines that causes error :
FaceletContext faceletContext = (FaceletContext) FacesContext.getCurrentInstance().getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
String formId = (String) faceletContext.getAttribute("hiddenIds");
do you have any idea
I also got the same error and resolved the issue by adding el-api-2.2 jar which contains the javax.el.ELContext class. The reason for the above error was javax.faces.view.facelets.FaceletContext class was internally calling the javax.el.ELContext class.

Resources