Questions tagged [java-annotations]

211 questions
1
vote
1 answer

How to get rid of "Null type safety" warning in eclipse neon for TreeMap

How to get rid of the warning in this example code. I use Eclipse Neon with Java 1.8 and org.eclipse.jdt.annotation_2.1.0 import java.util.Iterator; import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; import…
Torge
  • 2,174
  • 1
  • 23
  • 33
1
vote
1 answer

How to make Play! Framework 1.4.x preprocessing Java annotations?

I want to include a Java annotation with source retention in a Play! 1.4.x project, but can't find a way of passing additional arguments to the Play! internal Java compiler in order to make it preprocess the custom annotation. The annotation is the…
1
vote
1 answer

Drools externalize condition

In my organization we have decided to use KieServer for running drools. We are not using kieworkbench, this is because we need more control over the deployment and should be aligned with related application. The ask is to externalize the condition…
0
votes
1 answer

How to use Lombok's RequiredArgsConstructor with Nullaway?

We're trying to add "Nullaway" (https://github.com/uber/NullAway) to our repo. This is a tool that assumes everything not annotated with @Nullable can't be null and enforces it in compile time. We also use Lombok, with focus on @Data. Lombok decides…
0
votes
0 answers

Trying to inject a certain value into a field with annotation without @Value

I just got into java annotation processing and I wanted to create an annotation that does a similar job to @Value. I already created the annotation and annotation processor. so is there a way to inject the value from the process method? or am i…
0
votes
0 answers

Spring Boot Graphql: How can I pre-process an individual query/mutation before it runs the controller method?

I want to add an annotation to my controller methods that is used to check if the user can perform an action or access a piece of data before the controller method is called. I want to be able to check each individual query/mutation, rather than…
Mar
  • 7,765
  • 9
  • 48
  • 82
0
votes
0 answers

Find Java annotations via reflection for Kotlin getter

We have a wrapper class for checking the Android SDK version, and it uses the ChecksSdkIntAtLeast annotation. Here's a trimmed example of the class with just one getter and the logging removed: class DeviceApi( private val deviceOsVersion: Int )…
StormFoo
  • 1,129
  • 2
  • 10
  • 25
0
votes
0 answers

how to debug a java abstractProcess using vscode

I created an abstractProcess to generate a code when a Pojoproperty is annotated with my custom annotation and I save it. I have two projects: a project called MyAbstractProcessProject that has an annotation and my abstractProcess to process this…
0
votes
0 answers

How does Spring's @Cacheble annotation work?

I was looking into annotations but wasn't able to grasp how annotations actually work. So I tried to break my problem as follows: Lets suppose I have a spring boot project that is used as a dependency in various applications. I annotate one of its…
Stotra
  • 103
  • 7
0
votes
0 answers

Annotation with parameters already filled in

In the tech stack I'm working with we have an existing Java annotation for our unit tests which gets used like @TeamTest(size = TestSize.Medium, timeout = 5000) void myTest() { // setup and asserts and stuff } Is there a way to setup a separate…
Speed Fox
  • 45
  • 4
0
votes
1 answer

How to set boolean field for annotation

I am learning Spring annotation public @interface Autowired { boolean required() default true; } public @interface Lazy { boolean value() default true; } here is what I have: @Autowired(false) - wrong @Autowired(required=false) -…
Abe
  • 310
  • 3
  • 15
0
votes
0 answers

How to handle exceptions with @Resource (javax.annotation.resource)

Can I capture exceptions from resources looked up via @Resource? In the example below, a resource is being looked up via JNDI. There may not be a JNDI when running the app locally so I want to add an exception handler to capture this & create the…
Mr Smith
  • 3,318
  • 9
  • 47
  • 85
0
votes
0 answers

record-builder: TypeElement.getRecordComponents() returns duplicated record component (one without accessor)

While trying to troubleshoot & fix this issue from record-builder (a Java annotation processor), I observed that TypeElement.getRecordComponents() returns two entries for the same record component. I'm trying to understand if this behavior is…
Clément MATHIEU
  • 3,030
  • 23
  • 25
0
votes
0 answers

Why can't Spring AOP determine if proxy should be made for @target?

I can understand how @target expression works, but I wonder why applying @target has to be determined after loading Spring applications (after all beans are created). In my thought, right after objects to be registered as a bean are created, when…
davin111
  • 56
  • 5
0
votes
2 answers

Annotation value not reading from springboot properties.file

Created Custom annotation and add annotation at method level and pass value to Spring-Aspect. springboot: application.properties spring.event.type=TEST Output: PreHook Value|${spring.event.type} I am expecting : TEST Can someone please help how to…