From 5a8d8fd428197daa21234c6e9a16b2a2ca472508 Mon Sep 17 00:00:00 2001 From: Rob Stryker Date: Fri, 3 May 2024 00:59:48 -0400 Subject: [PATCH] Regression in ASTConverter15JLS8Test.test0006 - 0-arg marker annotations with parenthesis handled incorrectly Signed-off-by: Rob Stryker --- .../src/org/eclipse/jdt/core/dom/JavacConverter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java index ba607240179..ef6639d5df4 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java @@ -1980,7 +1980,11 @@ private Code convert(TypeKind javac) { } private Annotation convert(JCAnnotation javac) { - if( javac.getArguments().size() == 0) { + int startPos = javac.getStartPosition(); + int length = javac.getEndPosition(this.javacCompilationUnit.endPositions) - startPos; + String content = this.rawText.substring(startPos, startPos+length); + boolean mustUseNormalAnnot = content != null && content.contains("("); + if( javac.getArguments().size() == 0 && !mustUseNormalAnnot) { MarkerAnnotation res = this.ast.newMarkerAnnotation(); commonSettings(res, javac); res.setTypeName(toName(javac.getAnnotationType()));