-
Notifications
You must be signed in to change notification settings - Fork 36
Fix annotated types in new class expression #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
antonsviridov-src
merged 5 commits into
main
from
antonsviridov-graph-1020-npe-in-scip-java-when-using-type-annotations
Mar 4, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cfeb05d
Fix annotated types in new class expression
antonsviridov-src c26a110
better formatting
antonsviridov-src 53de798
I guess javafmt thinks differently..
antonsviridov-src 4810004
PR comments
antonsviridov-src d807f40
Fix
antonsviridov-src File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/minimized/src/main/java/minimized/TypeAnnotations.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package minimized; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ ElementType.TYPE_USE }) | ||
@interface TypeAnnotation { | ||
int integer() default 1; | ||
} | ||
|
||
// FIXME(issue: GRAPH-1122): Definition range for T below is incorrect | ||
class ClassProcessed<@TypeAnnotation T extends Number> { | ||
|
||
public ClassProcessed() { | ||
String s = new @TypeAnnotation String(); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...snapshots/src/main/generated/tests/minimized/src/main/java/minimized/TypeAnnotations.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package minimized; | ||
|
||
import java.lang.annotation.ElementType; | ||
// ^^^^ reference semanticdb maven . . java/ | ||
// ^^^^ reference semanticdb maven . . java/lang/ | ||
// ^^^^^^^^^^ reference semanticdb maven . . java/lang/annotation/ | ||
// ^^^^^^^^^^^ reference semanticdb maven jdk 11 java/lang/annotation/ElementType# | ||
import java.lang.annotation.Target; | ||
// ^^^^ reference semanticdb maven . . java/ | ||
// ^^^^ reference semanticdb maven . . java/lang/ | ||
// ^^^^^^^^^^ reference semanticdb maven . . java/lang/annotation/ | ||
// ^^^^^^ reference semanticdb maven jdk 11 java/lang/annotation/Target# | ||
|
||
@Target({ ElementType.TYPE_USE }) | ||
//^^^^^ reference semanticdb maven jdk 11 java/lang/annotation/Target# | ||
// ^^^^^^^^^^^ reference semanticdb maven jdk 11 java/lang/annotation/ElementType# | ||
// ^^^^^^^^ reference semanticdb maven jdk 11 java/lang/annotation/ElementType#TYPE_USE. | ||
@interface TypeAnnotation { | ||
// ^^^^^^^^^^^^^^ definition semanticdb maven . . minimized/TypeAnnotation# | ||
// display_name TypeAnnotation | ||
// signature_documentation java @Target({ElementType.TYPE_USE})\n@interface TypeAnnotation | ||
// kind Interface | ||
// relationship is_implementation semanticdb maven jdk 11 java/lang/annotation/Annotation# | ||
int integer() default 1; | ||
// ^^^^^^^ definition semanticdb maven . . minimized/TypeAnnotation#integer(). | ||
// display_name integer | ||
// signature_documentation java public abstract int integer() | ||
// kind AbstractMethod | ||
} | ||
|
||
// FIXME(issue: GRAPH-1122): Definition range for T below is incorrect | ||
class ClassProcessed<@TypeAnnotation T extends Number> { | ||
// ^^^^^^^^^^^^^^ definition semanticdb maven . . minimized/ClassProcessed# | ||
// display_name ClassProcessed | ||
// signature_documentation java class ClassProcessed<T extends Number> | ||
// kind Class | ||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition semanticdb maven . . minimized/ClassProcessed#[T] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this bug is caused by a separate issue, and I will fix it separately. |
||
// display_name T | ||
// signature_documentation java T extends Number | ||
// kind TypeParameter | ||
// ^^^^^^^^^^^^^^ reference semanticdb maven . . minimized/TypeAnnotation# | ||
// ^^^^^^ reference semanticdb maven jdk 11 java/lang/Number# | ||
|
||
public ClassProcessed() { | ||
// ^^^^^^^^^^^^^^ definition semanticdb maven . . minimized/ClassProcessed#`<init>`(). | ||
// display_name <init> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
nope, that's correct |
||
// signature_documentation java public ClassProcessed() | ||
// kind Constructor | ||
String s = new @TypeAnnotation String(); | ||
// ^^^^^^ reference semanticdb maven jdk 11 java/lang/String# | ||
// ^ definition local 0 | ||
// display_name s | ||
// signature_documentation java String s | ||
// enclosing_symbol semanticdb maven . . minimized/ClassProcessed#`<init>`(). | ||
// kind Variable | ||
// ^^^^^^^^^^^^^^ reference semanticdb maven . . minimized/TypeAnnotation# | ||
// ^^^^^^ reference semanticdb maven jdk 11 java/lang/String# | ||
// ^^^^^^ reference semanticdb maven jdk 11 java/lang/String#`<init>`(). | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.