Skip to content

Commit 949a9a2

Browse files
hopehadfieldrgrunber
authored andcommitted
Fix failed cast to TypeDeclaration in file paste event
1 parent 0375248 commit 949a9a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/PasteEventHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public static String handleFilePasteEvent(String path, String content, IProgress
367367
}
368368

369369
String possibleFileName = "Untitled";
370-
if (!root.types().isEmpty()) {
370+
if (!root.types().isEmpty() && root.types().get(0) instanceof TypeDeclaration) {
371371
possibleFileName = ((TypeDeclaration) root.types().get(0)).getName().getIdentifier();
372372
}
373373
if (Files.exists(Paths.get(desiredPath, possibleFileName + ".java"))) {

0 commit comments

Comments
 (0)