Skip to content

Commit

Permalink
Merge pull request #67 from jeddict/feature
Browse files Browse the repository at this point in the history
Set Java Parser LanguageLevel to JAVA_21
  • Loading branch information
jGauravGupta authored Dec 7, 2024
2 parents 7bdb243 + 6723ea6 commit 284b806
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package io.github.jeddict.ai.components;

import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.ParserConfiguration.LanguageLevel;
import com.github.javaparser.ast.CompilationUnit;
import static io.github.jeddict.ai.util.EditorUtil.getExtension;
import static io.github.jeddict.ai.util.EditorUtil.isSuitableForWebAppDirectory;
Expand Down Expand Up @@ -64,10 +66,8 @@
import javax.lang.model.element.Name;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.SwingUtilities;
import javax.swing.text.BadLocationException;
Expand All @@ -86,7 +86,6 @@
import org.openide.loaders.DataObject;
import org.openide.loaders.DataObjectNotFoundException;
import org.openide.windows.TopComponent;
import javax.swing.filechooser.FileSystemView;
import javax.swing.text.JTextComponent;
import javax.swing.text.StyledDocument;
import org.netbeans.api.editor.EditorRegistry;
Expand Down Expand Up @@ -388,6 +387,7 @@ public int getAllCodeEditorCount() {
}

public int getParseCodeEditor(List<FileObject> fileObjects) {
StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_21);
Map<JEditorPane, Map<String, String>> editorMethodSignCache = new HashMap<>();
Map<JEditorPane, Map<String, String>> editorMethodCache = new HashMap<>();
for (FileObject fileObject : fileObjects) {
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/io/github/jeddict/ai/util/SourceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package io.github.jeddict.ai.util;

import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.StaticJavaParser;
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.tree.ImportTree;
Expand All @@ -26,11 +28,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import javax.swing.text.BadLocationException;
import org.json.JSONArray;
import org.netbeans.api.java.source.JavaSource;
import org.netbeans.api.java.source.TreeMaker;
Expand All @@ -44,8 +42,8 @@
*/
public class SourceUtil {

public static void fixImports(FileObject fileObject) {
// TODO
static {
StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_21);
}

public static void printSource(FileObject fileObject) {
Expand Down

0 comments on commit 284b806

Please sign in to comment.