MySql parameters and SPEL. JPQL, HQL support for '%' in LIKE clause
This commit is contained in:
8
headless-services/commons/jpql/.gitignore
vendored
8
headless-services/commons/jpql/.gitignore
vendored
@@ -7,10 +7,10 @@
|
||||
/src/main/java/org/springframework/ide/vscode/parser/hql/Hql.tokens
|
||||
/src/main/java/org/springframework/ide/vscode/parser/hql/HqlLexer.interp
|
||||
/src/main/java/org/springframework/ide/vscode/parser/hql/HqlLexer.tokens
|
||||
/src/main/java/org/springframework/ide/vscode/parser/sql/MySqlParser.interp
|
||||
/src/main/java/org/springframework/ide/vscode/parser/sql/MySqlParser.tokens
|
||||
/src/main/java/org/springframework/ide/vscode/parser/sql/MySqlLexer.interp
|
||||
/src/main/java/org/springframework/ide/vscode/parser/sql/MySqlLexer.tokens
|
||||
/src/main/java/org/springframework/ide/vscode/parser/mysql/MySqlParser.interp
|
||||
/src/main/java/org/springframework/ide/vscode/parser/mysql/MySqlParser.tokens
|
||||
/src/main/java/org/springframework/ide/vscode/parser/mysql/MySqlLexer.interp
|
||||
/src/main/java/org/springframework/ide/vscode/parser/mysql/MySqlLexer.tokens
|
||||
/src/main/java/org/springframework/ide/vscode/parser/spel/SpelParser.interp
|
||||
/src/main/java/org/springframework/ide/vscode/parser/spel/SpelParser.tokens
|
||||
/src/main/java/org/springframework/ide/vscode/parser/spel/SpelLexer.interp
|
||||
|
||||
@@ -8,6 +8,6 @@ workdir=$(pwd)
|
||||
cd grammars
|
||||
java -jar ${workdir}/antlr-${ANTLR_VERSION}.jar Jpql.g4 -o ${workdir}/src/main/java/org/springframework/ide/vscode/parser/jpql -package org.springframework.ide.vscode.parser.jpql
|
||||
java -jar ${workdir}/antlr-${ANTLR_VERSION}.jar Hql.g4 -o ${workdir}/src/main/java/org/springframework/ide/vscode/parser/hql -package org.springframework.ide.vscode.parser.hql
|
||||
java -jar ${workdir}/antlr-${ANTLR_VERSION}.jar MySqlLexer.g4 MySqlParser.g4 -o ${workdir}/src/main/java/org/springframework/ide/vscode/parser/sql -package org.springframework.ide.vscode.parser.sql
|
||||
java -jar ${workdir}/antlr-${ANTLR_VERSION}.jar MySqlLexer.g4 MySqlParser.g4 -o ${workdir}/src/main/java/org/springframework/ide/vscode/parser/mysql -package org.springframework.ide.vscode.parser.mysql
|
||||
java -jar ${workdir}/antlr-${ANTLR_VERSION}.jar SpelLexer.g4 SpelParser.g4 -o ${workdir}/src/main/java/org/springframework/ide/vscode/parser/spel -package org.springframework.ide.vscode.parser.spel
|
||||
|
||||
|
||||
@@ -608,7 +608,7 @@ dealingWithNullExpression
|
||||
|
||||
// https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#hql-like-predicate
|
||||
stringPatternMatching
|
||||
: expression NOT? (LIKE | ILIKE) expression (ESCAPE (stringLiteral|parameter))?
|
||||
: expression NOT? (LIKE | ILIKE) ('%')? expression ('%')? (ESCAPE (stringLiteral|parameter))?
|
||||
;
|
||||
|
||||
// https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#hql-elements-indices
|
||||
@@ -673,7 +673,7 @@ variable
|
||||
|
||||
parameter
|
||||
: prefix=':' SPEL
|
||||
| prefix=':' identifier ('%')?
|
||||
| prefix=':' identifier
|
||||
| prefix='?' SPEL
|
||||
| prefix='?' INTEGER_LITERAL?
|
||||
;
|
||||
|
||||
@@ -342,7 +342,7 @@ in_item
|
||||
;
|
||||
|
||||
like_expression
|
||||
: string_expression (NOT)? LIKE pattern_value (ESCAPE escape_character)?
|
||||
: string_expression (NOT)? LIKE ('%')? pattern_value ('%')? (ESCAPE escape_character)?
|
||||
;
|
||||
|
||||
null_comparison_expression
|
||||
@@ -633,7 +633,7 @@ input_parameter
|
||||
: ':' SPEL
|
||||
| '?' SPEL
|
||||
| '?' INTLITERAL
|
||||
| ':' identification_variable ('%')?
|
||||
| ':' identification_variable
|
||||
;
|
||||
|
||||
pattern_value
|
||||
|
||||
@@ -44,7 +44,7 @@ SPACE : [ \t\r\n]+ -> channel(HIDDEN);
|
||||
SPEC_MYSQL_COMMENT : '/*!' .+? '*/' -> channel(MYSQLCOMMENT);
|
||||
COMMENT_INPUT : '/*' .*? '*/' -> channel(HIDDEN);
|
||||
LINE_COMMENT:
|
||||
(('--' [ \t]* | '#') ~[\r\n]* ('\r'? '\n' | EOF) | '--' ('\r'? '\n' | EOF)) -> channel(HIDDEN)
|
||||
(('--' [ \t]*) ~[\r\n]* ('\r'? '\n' | EOF) | '--' ('\r'? '\n' | EOF)) -> channel(HIDDEN)
|
||||
;
|
||||
|
||||
// Keywords
|
||||
@@ -1293,7 +1293,7 @@ HOST_IP_ADDRESS : (AT_SIGN IP_ADDRESS);
|
||||
LOCAL_ID : AT_SIGN ( STRING_LITERAL | [A-Z0-9._$\u0080-\uFFFF]+);
|
||||
GLOBAL_ID : AT_SIGN AT_SIGN ( [A-Z0-9._$\u0080-\uFFFF]+ | BQUOTA_STRING);
|
||||
|
||||
SPEL : ('#')('{')(.)*?('}') ;
|
||||
SPEL : '#{' ANYTHING '}';
|
||||
|
||||
// Fragments for Literal primitives
|
||||
|
||||
@@ -1341,6 +1341,7 @@ fragment CHARSET_NAME:
|
||||
| UTF8MB4
|
||||
;
|
||||
|
||||
fragment ANYTHING : (.)*?;
|
||||
fragment EXPONENT_NUM_PART : 'E' [-+]? DEC_DIGIT+;
|
||||
fragment ID_LITERAL : [A-Z_$0-9\u0080-\uFFFF]*? [A-Z_$\u0080-\uFFFF]+? [A-Z_$0-9\u0080-\uFFFF]*;
|
||||
fragment DQUOTA_STRING : '"' ( '\\' . | '""' | ~('"' | '\\'))* '"';
|
||||
|
||||
@@ -2544,7 +2544,7 @@ predicate
|
||||
|
||||
// Add in ASTVisitor nullNotnull in constant
|
||||
expressionAtom
|
||||
: (QUESTION_SYMB | COLON_SYMB) SPEL # spelExpressionAtom
|
||||
: parameter # parameterAtom
|
||||
| constant # constantExpressionAtom
|
||||
| fullColumnName # fullColumnNameExpressionAtom
|
||||
| functionCall # functionCallExpressionAtom
|
||||
@@ -2563,7 +2563,15 @@ expressionAtom
|
||||
| left = expressionAtom addOperator right = expressionAtom # mathExpressionAtom
|
||||
| left = expressionAtom jsonOperator right = expressionAtom # jsonExpressionAtom
|
||||
;
|
||||
|
||||
|
||||
parameter
|
||||
: prefix=':' SPEL
|
||||
| prefix=':' dottedId
|
||||
| prefix=':' uid
|
||||
| prefix='?' SPEL
|
||||
| prefix='?' decimalLiteral?
|
||||
;
|
||||
|
||||
unaryOperator
|
||||
: '!'
|
||||
| '~'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -78,8 +78,8 @@ public class JpqlLexer extends Lexer {
|
||||
|
||||
private static String[] makeLiteralNames() {
|
||||
return new String[] {
|
||||
null, "','", "'('", "')'", "'.'", "'>'", "'>='", "'<'", "'<='", "'+'",
|
||||
"'-'", "'*'", "'/'", "':'", "'?'", "'%'", null, null, null, null, null,
|
||||
null, "','", "'('", "')'", "'.'", "'%'", "'>'", "'>='", "'<'", "'<='",
|
||||
"'+'", "'-'", "'*'", "'/'", "':'", "'?'", null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null, null, null, null, null,
|
||||
@@ -205,8 +205,8 @@ public class JpqlLexer extends Lexer {
|
||||
"\u0089\u0007\u0089\u0002\u008a\u0007\u008a\u0002\u008b\u0007\u008b\u0001"+
|
||||
"\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0002\u0001\u0002\u0001"+
|
||||
"\u0003\u0001\u0003\u0001\u0004\u0001\u0004\u0001\u0005\u0001\u0005\u0001"+
|
||||
"\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001"+
|
||||
"\b\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001"+
|
||||
"\u0006\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001\b"+
|
||||
"\u0001\b\u0001\t\u0001\t\u0001\n\u0001\n\u0001\u000b\u0001\u000b\u0001"+
|
||||
"\f\u0001\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f"+
|
||||
"\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+
|
||||
"\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0014\u0001\u0014"+
|
||||
@@ -364,8 +364,8 @@ public class JpqlLexer extends Lexer {
|
||||
"\u0000\u0000\u0117\u0001\u0000\u0000\u0000\u0001\u0119\u0001\u0000\u0000"+
|
||||
"\u0000\u0003\u011b\u0001\u0000\u0000\u0000\u0005\u011d\u0001\u0000\u0000"+
|
||||
"\u0000\u0007\u011f\u0001\u0000\u0000\u0000\t\u0121\u0001\u0000\u0000\u0000"+
|
||||
"\u000b\u0123\u0001\u0000\u0000\u0000\r\u0126\u0001\u0000\u0000\u0000\u000f"+
|
||||
"\u0128\u0001\u0000\u0000\u0000\u0011\u012b\u0001\u0000\u0000\u0000\u0013"+
|
||||
"\u000b\u0123\u0001\u0000\u0000\u0000\r\u0125\u0001\u0000\u0000\u0000\u000f"+
|
||||
"\u0128\u0001\u0000\u0000\u0000\u0011\u012a\u0001\u0000\u0000\u0000\u0013"+
|
||||
"\u012d\u0001\u0000\u0000\u0000\u0015\u012f\u0001\u0000\u0000\u0000\u0017"+
|
||||
"\u0131\u0001\u0000\u0000\u0000\u0019\u0133\u0001\u0000\u0000\u0000\u001b"+
|
||||
"\u0135\u0001\u0000\u0000\u0000\u001d\u0137\u0001\u0000\u0000\u0000\u001f"+
|
||||
@@ -432,17 +432,17 @@ public class JpqlLexer extends Lexer {
|
||||
"\u011b\u011c\u0005(\u0000\u0000\u011c\u0004\u0001\u0000\u0000\u0000\u011d"+
|
||||
"\u011e\u0005)\u0000\u0000\u011e\u0006\u0001\u0000\u0000\u0000\u011f\u0120"+
|
||||
"\u0005.\u0000\u0000\u0120\b\u0001\u0000\u0000\u0000\u0121\u0122\u0005"+
|
||||
">\u0000\u0000\u0122\n\u0001\u0000\u0000\u0000\u0123\u0124\u0005>\u0000"+
|
||||
"\u0000\u0124\u0125\u0005=\u0000\u0000\u0125\f\u0001\u0000\u0000\u0000"+
|
||||
"\u0126\u0127\u0005<\u0000\u0000\u0127\u000e\u0001\u0000\u0000\u0000\u0128"+
|
||||
"\u0129\u0005<\u0000\u0000\u0129\u012a\u0005=\u0000\u0000\u012a\u0010\u0001"+
|
||||
"\u0000\u0000\u0000\u012b\u012c\u0005+\u0000\u0000\u012c\u0012\u0001\u0000"+
|
||||
"\u0000\u0000\u012d\u012e\u0005-\u0000\u0000\u012e\u0014\u0001\u0000\u0000"+
|
||||
"\u0000\u012f\u0130\u0005*\u0000\u0000\u0130\u0016\u0001\u0000\u0000\u0000"+
|
||||
"\u0131\u0132\u0005/\u0000\u0000\u0132\u0018\u0001\u0000\u0000\u0000\u0133"+
|
||||
"\u0134\u0005:\u0000\u0000\u0134\u001a\u0001\u0000\u0000\u0000\u0135\u0136"+
|
||||
"\u0005?\u0000\u0000\u0136\u001c\u0001\u0000\u0000\u0000\u0137\u0138\u0005"+
|
||||
"%\u0000\u0000\u0138\u001e\u0001\u0000\u0000\u0000\u0139\u013a\u0007\u0000"+
|
||||
"%\u0000\u0000\u0122\n\u0001\u0000\u0000\u0000\u0123\u0124\u0005>\u0000"+
|
||||
"\u0000\u0124\f\u0001\u0000\u0000\u0000\u0125\u0126\u0005>\u0000\u0000"+
|
||||
"\u0126\u0127\u0005=\u0000\u0000\u0127\u000e\u0001\u0000\u0000\u0000\u0128"+
|
||||
"\u0129\u0005<\u0000\u0000\u0129\u0010\u0001\u0000\u0000\u0000\u012a\u012b"+
|
||||
"\u0005<\u0000\u0000\u012b\u012c\u0005=\u0000\u0000\u012c\u0012\u0001\u0000"+
|
||||
"\u0000\u0000\u012d\u012e\u0005+\u0000\u0000\u012e\u0014\u0001\u0000\u0000"+
|
||||
"\u0000\u012f\u0130\u0005-\u0000\u0000\u0130\u0016\u0001\u0000\u0000\u0000"+
|
||||
"\u0131\u0132\u0005*\u0000\u0000\u0132\u0018\u0001\u0000\u0000\u0000\u0133"+
|
||||
"\u0134\u0005/\u0000\u0000\u0134\u001a\u0001\u0000\u0000\u0000\u0135\u0136"+
|
||||
"\u0005:\u0000\u0000\u0136\u001c\u0001\u0000\u0000\u0000\u0137\u0138\u0005"+
|
||||
"?\u0000\u0000\u0138\u001e\u0001\u0000\u0000\u0000\u0139\u013a\u0007\u0000"+
|
||||
"\u0000\u0000\u013a\u013b\u0001\u0000\u0000\u0000\u013b\u013c\u0006\u000f"+
|
||||
"\u0000\u0000\u013c \u0001\u0000\u0000\u0000\u013d\u013e\u0007\u0001\u0000"+
|
||||
"\u0000\u013e\"\u0001\u0000\u0000\u0000\u013f\u0140\u0007\u0002\u0000\u0000"+
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
// Generated from MySqlParser.g4 by ANTLR 4.13.1
|
||||
package org.springframework.ide.vscode.parser.sql;
|
||||
package org.springframework.ide.vscode.parser.mysql;
|
||||
|
||||
import org.antlr.v4.runtime.ParserRuleContext;
|
||||
import org.antlr.v4.runtime.tree.ErrorNode;
|
||||
@@ -7068,6 +7068,18 @@ public class MySqlParserBaseListener implements MySqlParserListener {
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitRegexpPredicate(MySqlParser.RegexpPredicateContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterParameterAtom(MySqlParser.ParameterAtomContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitParameterAtom(MySqlParser.ParameterAtomContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@@ -7176,18 +7188,6 @@ public class MySqlParserBaseListener implements MySqlParserListener {
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitIntervalExpressionAtom(MySqlParser.IntervalExpressionAtomContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterSpelExpressionAtom(MySqlParser.SpelExpressionAtomContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitSpelExpressionAtom(MySqlParser.SpelExpressionAtomContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@@ -7272,6 +7272,18 @@ public class MySqlParserBaseListener implements MySqlParserListener {
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitBitExpressionAtom(MySqlParser.BitExpressionAtomContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void enterParameter(MySqlParser.ParameterContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation does nothing.</p>
|
||||
*/
|
||||
@Override public void exitParameter(MySqlParser.ParameterContext ctx) { }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
@@ -1,5 +1,5 @@
|
||||
// Generated from MySqlParser.g4 by ANTLR 4.13.1
|
||||
package org.springframework.ide.vscode.parser.sql;
|
||||
package org.springframework.ide.vscode.parser.mysql;
|
||||
import org.antlr.v4.runtime.tree.ParseTreeListener;
|
||||
|
||||
/**
|
||||
@@ -6457,6 +6457,18 @@ public interface MySqlParserListener extends ParseTreeListener {
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitRegexpPredicate(MySqlParser.RegexpPredicateContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code parameterAtom}
|
||||
* labeled alternative in {@link MySqlParser#expressionAtom}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterParameterAtom(MySqlParser.ParameterAtomContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code parameterAtom}
|
||||
* labeled alternative in {@link MySqlParser#expressionAtom}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitParameterAtom(MySqlParser.ParameterAtomContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code unaryExpressionAtom}
|
||||
* labeled alternative in {@link MySqlParser#expressionAtom}.
|
||||
@@ -6565,18 +6577,6 @@ public interface MySqlParserListener extends ParseTreeListener {
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitIntervalExpressionAtom(MySqlParser.IntervalExpressionAtomContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code spelExpressionAtom}
|
||||
* labeled alternative in {@link MySqlParser#expressionAtom}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterSpelExpressionAtom(MySqlParser.SpelExpressionAtomContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by the {@code spelExpressionAtom}
|
||||
* labeled alternative in {@link MySqlParser#expressionAtom}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitSpelExpressionAtom(MySqlParser.SpelExpressionAtomContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by the {@code jsonExpressionAtom}
|
||||
* labeled alternative in {@link MySqlParser#expressionAtom}.
|
||||
@@ -6661,6 +6661,16 @@ public interface MySqlParserListener extends ParseTreeListener {
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitBitExpressionAtom(MySqlParser.BitExpressionAtomContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by {@link MySqlParser#parameter}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void enterParameter(MySqlParser.ParameterContext ctx);
|
||||
/**
|
||||
* Exit a parse tree produced by {@link MySqlParser#parameter}.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
void exitParameter(MySqlParser.ParameterContext ctx);
|
||||
/**
|
||||
* Enter a parse tree produced by {@link MySqlParser#unaryOperator}.
|
||||
* @param ctx the parse tree
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,12 +25,11 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.ide.vscode.boot.factories.SpringFactoriesLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.boot.index.cache.IndexCache;
|
||||
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.HqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.HqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpaQueryPropertiesLanguageServerComponents;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSupportState;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.boot.java.links.JavaElementLocationProvider;
|
||||
import org.springframework.ide.vscode.boot.java.links.SourceLinks;
|
||||
import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider;
|
||||
@@ -131,7 +130,7 @@ public class BootLanguageServerInitializer implements InitializingBean {
|
||||
new SpringFactoriesLanguageServerComponents(projectFinder, springIndexer, config),
|
||||
new PomLanguageServerComponents(server, projectFinder, params.projectObserver, appContext.getBean(SpringProjectsProvider.class)),
|
||||
new JpaQueryPropertiesLanguageServerComponents(server.getTextDocumentService(), projectFinder, appContext.getBean(JpqlSemanticTokens.class),
|
||||
appContext.getBean(HqlSemanticTokens.class), appContext.getBean(JpqlSupportState.class), appContext.getBean(HqlReconciler.class), appContext.getBean(JpqlReconciler.class))
|
||||
appContext.getBean(HqlSemanticTokens.class), appContext.getBean(JpqlSupportState.class), (Reconciler) appContext.getBean("hqlReconciler"), (Reconciler) appContext.getBean("jpqlReconciler"))
|
||||
);
|
||||
|
||||
for (LanguageServerComponents c : componentsList) {
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.app;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.HqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.HqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JdtDataQuerySemanticTokensProvider;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSupportState;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.QueryJdtAstReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.SqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.SqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.boot.java.reconcilers.AddConfigurationIfBeansPresentReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.reconcilers.AuthorizeHttpRequestsReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.reconcilers.AutowiredFieldIntoConstructorParameterReconciler;
|
||||
@@ -122,12 +122,15 @@ public class JdtConfig {
|
||||
return new JavaSemanticTokensProvider();
|
||||
}
|
||||
|
||||
@Bean JdtDataQuerySemanticTokensProvider jpqlJdtSemanticTokensProvider(JpqlSemanticTokens jpqlProvider, HqlSemanticTokens hqlProvider, SqlSemanticTokens sqlSemanticTokens, JpqlSupportState supportState) {
|
||||
return new JdtDataQuerySemanticTokensProvider(jpqlProvider, hqlProvider, sqlSemanticTokens, supportState);
|
||||
@Bean JdtDataQuerySemanticTokensProvider jpqlJdtSemanticTokensProvider(JpqlSemanticTokens jpqlProvider, HqlSemanticTokens hqlProvider, JpqlSupportState supportState, Optional<SpelSemanticTokens> spelSemanticTokens) {
|
||||
return new JdtDataQuerySemanticTokensProvider(jpqlProvider, hqlProvider, supportState, spelSemanticTokens);
|
||||
}
|
||||
|
||||
@Bean QueryJdtAstReconciler dataQueryReconciler(HqlReconciler hqlReconciler, JpqlReconciler jpqlReconciler, SqlReconciler sqlReconciler) {
|
||||
return new QueryJdtAstReconciler(hqlReconciler, jpqlReconciler, sqlReconciler);
|
||||
@Bean QueryJdtAstReconciler dataQueryReconciler(
|
||||
@Qualifier("hqlReconciler") Reconciler hqlReconciler,
|
||||
@Qualifier("jpqlReconciler") Reconciler jpqlReconciler,
|
||||
Optional<SpelReconciler> spelReconciler) {
|
||||
return new QueryJdtAstReconciler(hqlReconciler, jpqlReconciler, spelReconciler);
|
||||
}
|
||||
|
||||
@Bean EmbeddedLanguagesSemanticTokensSupport embbededLanguagesSyntaxHighlighting(SimpleLanguageServer server, BootJavaConfig config) {
|
||||
|
||||
@@ -14,17 +14,19 @@ import java.util.Optional;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.HqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.AntlrReconcilerWithSpel;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.HqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.JpqlSupportState;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.SqlReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.SqlSemanticTokens;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.QueryProblemType;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelSemanticTokens;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver;
|
||||
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
|
||||
import org.springframework.ide.vscode.parser.hql.HqlLexer;
|
||||
import org.springframework.ide.vscode.parser.hql.HqlParser;
|
||||
import org.springframework.ide.vscode.parser.jpql.JpqlLexer;
|
||||
import org.springframework.ide.vscode.parser.jpql.JpqlParser;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class SpringDataConfig {
|
||||
@@ -39,26 +41,16 @@ public class SpringDataConfig {
|
||||
return new HqlSemanticTokens(optSpelTokensProvider);
|
||||
}
|
||||
|
||||
@Bean
|
||||
SqlSemanticTokens sqlSemanticTokens(Optional<SpelSemanticTokens> optSpelTokensProvider) {
|
||||
return new SqlSemanticTokens(optSpelTokensProvider);
|
||||
@Bean("hqlReconciler")
|
||||
AntlrReconcilerWithSpel hqlReconciler(Optional<SpelReconciler> spelReconciler) {
|
||||
return new AntlrReconcilerWithSpel("HQL", HqlParser.class, HqlLexer.class, "ql_statement", QueryProblemType.HQL_SYNTAX, spelReconciler, HqlLexer.SPEL);
|
||||
}
|
||||
|
||||
@Bean
|
||||
HqlReconciler hqlReconciler(Optional<SpelReconciler> spelReconciler) {
|
||||
return new HqlReconciler(spelReconciler);
|
||||
@Bean("jpqlReconciler")
|
||||
AntlrReconcilerWithSpel jpqlReconciler(Optional<SpelReconciler> spelReconciler) {
|
||||
return new AntlrReconcilerWithSpel("JPQL", JpqlParser.class, JpqlLexer.class, "ql_statement", QueryProblemType.JPQL_SYNTAX, spelReconciler, JpqlLexer.SPEL);
|
||||
}
|
||||
|
||||
@Bean
|
||||
JpqlReconciler jpqlReconciler(Optional<SpelReconciler> spelReconciler) {
|
||||
return new JpqlReconciler(spelReconciler);
|
||||
}
|
||||
|
||||
@Bean
|
||||
SqlReconciler sqlReconciler(Optional<SpelReconciler> spelReconciler) {
|
||||
return new SqlReconciler(spelReconciler);
|
||||
}
|
||||
|
||||
@Bean
|
||||
JpqlSupportState jpqlSupportState(SimpleLanguageServer server, ProjectObserver projectObserver, BootJavaConfig config) {
|
||||
return new JpqlSupportState(server, projectObserver, config);
|
||||
|
||||
@@ -11,42 +11,50 @@
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import java.util.BitSet;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.antlr.v4.runtime.ANTLRErrorListener;
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.ConsoleErrorListener;
|
||||
import org.antlr.v4.runtime.Lexer;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.RecognitionException;
|
||||
import org.antlr.v4.runtime.Recognizer;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.TokenStream;
|
||||
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
import org.antlr.v4.runtime.tree.ErrorNode;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelReconciler;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl;
|
||||
import org.springframework.ide.vscode.parser.hql.HqlBaseListener;
|
||||
import org.springframework.ide.vscode.parser.hql.HqlLexer;
|
||||
import org.springframework.ide.vscode.parser.hql.HqlParser;
|
||||
import org.springframework.ide.vscode.parser.jpql.JpqlParser;
|
||||
|
||||
public class HqlReconciler implements Reconciler {
|
||||
public class AntlrReconciler implements Reconciler {
|
||||
|
||||
private final Optional<SpelReconciler> spelReconciler;
|
||||
private static final Logger log = LoggerFactory.getLogger(AntlrReconciler.class);
|
||||
|
||||
private final String prefix;
|
||||
private final Class<? extends Parser> parserClass;
|
||||
private final Class<? extends Lexer> lexerClass;
|
||||
private final String parseMethod;
|
||||
private final ProblemType problemType;
|
||||
|
||||
public HqlReconciler(Optional<SpelReconciler> spelReconiler) {
|
||||
this.spelReconciler = spelReconiler;
|
||||
public AntlrReconciler(String prefix, Class<? extends Parser> parserClass, Class<? extends Lexer> lexerClass,
|
||||
String parseMethod, ProblemType problemType) {
|
||||
this.prefix = prefix;
|
||||
this.parserClass = parserClass;
|
||||
this.lexerClass = lexerClass;
|
||||
this.parseMethod = parseMethod;
|
||||
this.problemType = problemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconcile(String text, int startPosition, IProblemCollector problemCollector) {
|
||||
HqlLexer lexer = new HqlLexer(CharStreams.fromString(text));
|
||||
protected Parser createParser(String text, int startPosition, IProblemCollector problemCollector) throws Exception {
|
||||
Lexer lexer = lexerClass.getDeclaredConstructor(CharStream.class).newInstance(CharStreams.fromString(text));
|
||||
CommonTokenStream antlrTokens = new CommonTokenStream(lexer);
|
||||
HqlParser parser = new HqlParser(antlrTokens);
|
||||
Parser parser = parserClass.getDeclaredConstructor(TokenStream.class).newInstance(antlrTokens);
|
||||
|
||||
lexer.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
parser.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
@@ -63,7 +71,7 @@ public class HqlReconciler implements Reconciler {
|
||||
offset = token.getStartIndex() - token.getCharPositionInLine();
|
||||
length = token.getCharPositionInLine() + 1;
|
||||
}
|
||||
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.HQL_SYNTAX, "HQL: " + msg, startPosition + offset, length));
|
||||
problemCollector.accept(new ReconcileProblemImpl(problemType, prefix + ": " + msg, startPosition + offset, length));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,28 +90,17 @@ public class HqlReconciler implements Reconciler {
|
||||
}
|
||||
});
|
||||
|
||||
// Reconcile embedded SPEL
|
||||
parser.addParseListener(new HqlBaseListener() {
|
||||
|
||||
private void processTerminal(TerminalNode node) {
|
||||
if (node.getSymbol().getType() == JpqlParser.SPEL) {
|
||||
spelReconciler.ifPresent(r -> JpqlReconciler.reconcileEmbeddedSpelNode(node, startPosition, r, problemCollector));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTerminal(TerminalNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitErrorNode(ErrorNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
parser.ql_statement();
|
||||
|
||||
return parser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconcile(String text, int startPosition, IProblemCollector problemCollector) {
|
||||
try {
|
||||
Parser parser = createParser(text, startPosition, problemCollector);
|
||||
parserClass.getDeclaredMethod(parseMethod).invoke(parser);
|
||||
} catch (Throwable t) {
|
||||
log.error("", t);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Broadcom, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.antlr.v4.runtime.Lexer;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.ParserRuleContext;
|
||||
import org.antlr.v4.runtime.tree.ErrorNode;
|
||||
import org.antlr.v4.runtime.tree.ParseTreeListener;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelReconciler;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType;
|
||||
|
||||
public class AntlrReconcilerWithSpel extends AntlrReconciler {
|
||||
|
||||
private final Optional<SpelReconciler> spelReconciler;
|
||||
private final int spelTokenType;
|
||||
|
||||
public AntlrReconcilerWithSpel(String prefix, Class<? extends Parser> parserClass, Class<? extends Lexer> lexerClass,
|
||||
String parseMethod, ProblemType problemType, Optional<SpelReconciler> spelReconciler, int spelTokenType) {
|
||||
super(prefix, parserClass, lexerClass, parseMethod, problemType);
|
||||
this.spelReconciler = spelReconciler;
|
||||
this.spelTokenType = spelTokenType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Parser createParser(String text, int startPosition, IProblemCollector problemCollector) throws Exception {
|
||||
Parser parser = super.createParser(text, startPosition, problemCollector);
|
||||
|
||||
// Reconcile embedded SPEL
|
||||
spelReconciler.ifPresent(r -> parser.addParseListener(new ParseTreeListener() {
|
||||
|
||||
private void processTerminal(TerminalNode node) {
|
||||
if (node.getSymbol().getType() == spelTokenType) {
|
||||
AntlrReconcilerWithSpel.reconcileEmbeddedSpelNode(node, startPosition, r, problemCollector);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTerminal(TerminalNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitErrorNode(ErrorNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterEveryRule(ParserRuleContext ctx) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitEveryRule(ParserRuleContext ctx) {
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
return parser;
|
||||
}
|
||||
|
||||
private static void reconcileEmbeddedSpelNode(TerminalNode node, int initialOffset, SpelReconciler spelReconciler, IProblemCollector problemCollector) {
|
||||
int startPosition = initialOffset + node.getSymbol().getStartIndex();
|
||||
String spelContent = node.getSymbol().getText().substring(2, node.getSymbol().getText().length() - 1);
|
||||
spelReconciler.reconcile(spelContent, startPosition, problemCollector);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,10 @@
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -27,6 +30,7 @@ import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
|
||||
import org.eclipse.jdt.core.dom.StringLiteral;
|
||||
import org.eclipse.jdt.core.dom.TextBlock;
|
||||
import org.springframework.ide.vscode.boot.java.JdtSemanticTokensProvider;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelSemanticTokens;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.java.SpringProjectUtil;
|
||||
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
|
||||
@@ -41,14 +45,17 @@ public class JdtDataQuerySemanticTokensProvider implements JdtSemanticTokensProv
|
||||
|
||||
private final JpqlSemanticTokens jpqlProvider;
|
||||
private final HqlSemanticTokens hqlProvider;
|
||||
private final SqlSemanticTokens sqlProvider;
|
||||
private final JpqlSupportState supportState;
|
||||
private final Map<SqlType, SemanticTokensDataProvider> sqlTokenProviders;
|
||||
|
||||
|
||||
public JdtDataQuerySemanticTokensProvider(JpqlSemanticTokens jpqlProvider, HqlSemanticTokens hqlProvider, SqlSemanticTokens sqlSemanticTokens, JpqlSupportState supportState) {
|
||||
public JdtDataQuerySemanticTokensProvider(JpqlSemanticTokens jpqlProvider, HqlSemanticTokens hqlProvider, JpqlSupportState supportState, Optional<SpelSemanticTokens> spelSemanticTokens) {
|
||||
this.jpqlProvider = jpqlProvider;
|
||||
this.hqlProvider = hqlProvider;
|
||||
this.sqlProvider = sqlSemanticTokens;
|
||||
this.supportState = supportState;
|
||||
|
||||
this.sqlTokenProviders = new LinkedHashMap<>();
|
||||
this.sqlTokenProviders.put(SqlType.MYSQL, new MySqlSemanticTokens(spelSemanticTokens));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,7 +104,7 @@ public class JdtDataQuerySemanticTokensProvider implements JdtSemanticTokensProv
|
||||
|
||||
if (queryExpression != null) {
|
||||
if (isNative) {
|
||||
computeTokensForQueryExpression(sqlProvider, queryExpression).forEach(tokensData::accept);
|
||||
computeTokensForQueryExpression(getSqlSemanticTokensProvider(jp), queryExpression).forEach(tokensData::accept);
|
||||
} else {
|
||||
computeTokensForQueryExpression(provider, queryExpression).forEach(tokensData::accept);
|
||||
}
|
||||
@@ -160,5 +167,9 @@ public class JdtDataQuerySemanticTokensProvider implements JdtSemanticTokensProv
|
||||
public boolean isApplicable(IJavaProject project) {
|
||||
return supportState.isEnabled() && SpringProjectUtil.hasDependencyStartingWith(project, "spring-data-jpa", null);
|
||||
}
|
||||
|
||||
private SemanticTokensDataProvider getSqlSemanticTokensProvider(IJavaProject project) {
|
||||
return sqlTokenProviders.get(SqlType.MYSQL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.commons.languageserver.composable.LanguageServerComponents;
|
||||
import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine;
|
||||
@@ -27,7 +28,7 @@ public class JpaQueryPropertiesLanguageServerComponents implements LanguageServe
|
||||
|
||||
public JpaQueryPropertiesLanguageServerComponents(SimpleTextDocumentService documents, JavaProjectFinder projectsFinder,
|
||||
JpqlSemanticTokens jpqlSemanticTokensProvider, HqlSemanticTokens hqlSematicTokensProvider, JpqlSupportState supportState,
|
||||
HqlReconciler hqlReconciler, JpqlReconciler jpqlReconciler) {
|
||||
Reconciler hqlReconciler, Reconciler jpqlReconciler) {
|
||||
this.semanticTokensHandler = new QueryPropertiesSemanticTokensHandler(projectsFinder, jpqlSemanticTokensProvider, hqlSematicTokensProvider, supportState);
|
||||
this.reconcileEngine = new NamedQueryPropertiesReconcileEngine(projectsFinder, hqlReconciler, jpqlReconciler);
|
||||
}
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Broadcom, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import java.util.BitSet;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.antlr.v4.runtime.ANTLRErrorListener;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.ConsoleErrorListener;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.RecognitionException;
|
||||
import org.antlr.v4.runtime.Recognizer;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
import org.antlr.v4.runtime.tree.ErrorNode;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelReconciler;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl;
|
||||
import org.springframework.ide.vscode.parser.jpql.JpqlBaseListener;
|
||||
import org.springframework.ide.vscode.parser.jpql.JpqlLexer;
|
||||
import org.springframework.ide.vscode.parser.jpql.JpqlParser;
|
||||
|
||||
public class JpqlReconciler implements Reconciler {
|
||||
|
||||
private final Optional<SpelReconciler> spelReconciler;
|
||||
|
||||
public JpqlReconciler(Optional<SpelReconciler> spelReconciler) {
|
||||
this.spelReconciler = spelReconciler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconcile(String text, int startPosition, IProblemCollector problemCollector) {
|
||||
JpqlLexer lexer = new JpqlLexer(CharStreams.fromString(text));
|
||||
CommonTokenStream antlrTokens = new CommonTokenStream(lexer);
|
||||
JpqlParser parser = new JpqlParser(antlrTokens);
|
||||
|
||||
lexer.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
parser.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
|
||||
parser.addErrorListener(new ANTLRErrorListener() {
|
||||
|
||||
@Override
|
||||
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
|
||||
String msg, RecognitionException e) {
|
||||
Token token = (Token) offendingSymbol;
|
||||
int offset = token.getStartIndex();
|
||||
int length = token.getStopIndex() - token.getStartIndex() + 1;
|
||||
if (token.getStartIndex() >= token.getStopIndex()) {
|
||||
offset = token.getStartIndex() - token.getCharPositionInLine();
|
||||
length = token.getCharPositionInLine() + 1;
|
||||
}
|
||||
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.JPQL_SYNTAX, "JPQL: " + msg, startPosition + offset, length));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, int prediction,
|
||||
ATNConfigSet configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex,
|
||||
BitSet conflictingAlts, ATNConfigSet configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, boolean exact,
|
||||
BitSet ambigAlts, ATNConfigSet configs) {
|
||||
}
|
||||
});
|
||||
|
||||
// Reconcile embedded SPEL
|
||||
parser.addParseListener(new JpqlBaseListener() {
|
||||
|
||||
private void processTerminal(TerminalNode node) {
|
||||
if (node.getSymbol().getType() == JpqlParser.SPEL) {
|
||||
spelReconciler.ifPresent(r -> reconcileEmbeddedSpelNode(node, startPosition, r, problemCollector));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTerminal(TerminalNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitErrorNode(ErrorNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
parser.ql_statement();
|
||||
|
||||
}
|
||||
|
||||
static void reconcileEmbeddedSpelNode(TerminalNode node, int initialOffset, SpelReconciler spelReconciler, IProblemCollector problemCollector) {
|
||||
int startPosition = initialOffset + node.getSymbol().getStartIndex();
|
||||
String spelContent = node.getSymbol().getText().substring(2, node.getSymbol().getText().length() - 1);
|
||||
spelReconciler.reconcile(spelContent, startPosition, problemCollector);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,41 +11,37 @@
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.antlr.v4.runtime.ANTLRErrorListener;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.ConsoleErrorListener;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.RecognitionException;
|
||||
import org.antlr.v4.runtime.Recognizer;
|
||||
import org.antlr.v4.runtime.ParserRuleContext;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
import org.antlr.v4.runtime.tree.ErrorNode;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelSemanticTokens;
|
||||
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
|
||||
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokensDataProvider;
|
||||
import org.springframework.ide.vscode.parser.sql.MySqlLexer;
|
||||
import org.springframework.ide.vscode.parser.sql.MySqlParser;
|
||||
import org.springframework.ide.vscode.parser.sql.MySqlParserBaseListener;
|
||||
import org.springframework.ide.vscode.parser.mysql.MySqlLexer;
|
||||
import org.springframework.ide.vscode.parser.mysql.MySqlParser;
|
||||
import org.springframework.ide.vscode.parser.mysql.MySqlParser.ParameterContext;
|
||||
import org.springframework.ide.vscode.parser.mysql.MySqlParserBaseListener;
|
||||
|
||||
public class SqlSemanticTokens implements SemanticTokensDataProvider {
|
||||
public class MySqlSemanticTokens implements SemanticTokensDataProvider {
|
||||
|
||||
private static List<String> TOKEN_TYPES = List.of("keyword", "type", "string", "number", "operator",
|
||||
"variable", "regexp", "comment");
|
||||
"variable", "regexp", "comment", "parameter");
|
||||
|
||||
private Optional<SpelSemanticTokens> optSpelTokens;
|
||||
|
||||
public SqlSemanticTokens(Optional<SpelSemanticTokens> optSpelTokens) {
|
||||
public MySqlSemanticTokens(Optional<SpelSemanticTokens> optSpelTokens) {
|
||||
this.optSpelTokens = optSpelTokens;
|
||||
}
|
||||
|
||||
@@ -184,38 +180,31 @@ public class SqlSemanticTokens implements SemanticTokensDataProvider {
|
||||
public void visitErrorNode(ErrorNode node) {
|
||||
processTerminalNode(node);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
parser.addErrorListener(new ANTLRErrorListener() {
|
||||
|
||||
|
||||
@Override
|
||||
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
|
||||
String msg, RecognitionException e) {
|
||||
// TODO Auto-generated method stub
|
||||
msg.length();
|
||||
public void exitParameter(ParameterContext ctx) {
|
||||
if (ctx.dottedId() != null) {
|
||||
getAllLeafs(ctx.dottedId()).forEach(t -> semantics.put(t, "parameter"));
|
||||
}
|
||||
if (ctx.uid() != null) {
|
||||
getAllLeafs(ctx.uid()).forEach(t -> semantics.put(t, "parameter"));
|
||||
}
|
||||
if (ctx.decimalLiteral() != null) {
|
||||
getAllLeafs(ctx.decimalLiteral()).forEach(t -> semantics.put(t, "parameter"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, int prediction,
|
||||
ATNConfigSet configs) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
private Stream<Token> getAllLeafs(ParserRuleContext ctx) {
|
||||
return ctx.children.stream().flatMap(n -> {
|
||||
if (n instanceof ParserRuleContext prc) {
|
||||
return getAllLeafs(prc);
|
||||
} else if (n instanceof TerminalNode tn) {
|
||||
return Stream.of(tn.getSymbol());
|
||||
}
|
||||
return Stream.empty();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex,
|
||||
BitSet conflictingAlts, ATNConfigSet configs) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, boolean exact,
|
||||
BitSet ambigAlts, ATNConfigSet configs) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
parser.sqlStatements();
|
||||
@@ -25,10 +25,10 @@ import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Value
|
||||
public class NamedQueryPropertiesReconcileEngine implements IReconcileEngine {
|
||||
|
||||
private final JavaProjectFinder projectFinder;
|
||||
private final HqlReconciler hqlReconciler;
|
||||
private final JpqlReconciler jpqlReconciler;
|
||||
private final Reconciler hqlReconciler;
|
||||
private final Reconciler jpqlReconciler;
|
||||
|
||||
public NamedQueryPropertiesReconcileEngine(JavaProjectFinder projectFinder, HqlReconciler hqlReconciler, JpqlReconciler jpqlReconciler) {
|
||||
public NamedQueryPropertiesReconcileEngine(JavaProjectFinder projectFinder, Reconciler hqlReconciler, Reconciler jpqlReconciler) {
|
||||
this.projectFinder = projectFinder;
|
||||
this.hqlReconciler = hqlReconciler;
|
||||
this.jpqlReconciler = jpqlReconciler;
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.core.dom.ASTVisitor;
|
||||
import org.eclipse.jdt.core.dom.CompilationUnit;
|
||||
@@ -28,23 +31,28 @@ import org.springframework.ide.vscode.boot.java.annotations.AnnotationHierarchie
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.boot.java.reconcilers.JdtAstReconciler;
|
||||
import org.springframework.ide.vscode.boot.java.reconcilers.RequiredCompleteAstException;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelReconciler;
|
||||
import org.springframework.ide.vscode.commons.java.IJavaProject;
|
||||
import org.springframework.ide.vscode.commons.java.SpringProjectUtil;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType;
|
||||
import org.springframework.ide.vscode.parser.mysql.MySqlLexer;
|
||||
import org.springframework.ide.vscode.parser.mysql.MySqlParser;
|
||||
|
||||
public class QueryJdtAstReconciler implements JdtAstReconciler {
|
||||
|
||||
private final HqlReconciler hqlReconciler;
|
||||
private final JpqlReconciler jpqlReconciler;
|
||||
private final SqlReconciler sqlReconciler;
|
||||
private final Reconciler hqlReconciler;
|
||||
private final Reconciler jpqlReconciler;
|
||||
private final Map<SqlType, Reconciler> sqlReconcilers;
|
||||
|
||||
|
||||
public QueryJdtAstReconciler(HqlReconciler hqlReconciler, JpqlReconciler jpqlReconciler,
|
||||
SqlReconciler sqlReconciler) {
|
||||
public QueryJdtAstReconciler(Reconciler hqlReconciler, Reconciler jpqlReconciler,
|
||||
Optional<SpelReconciler> spelReconciler) {
|
||||
this.hqlReconciler = hqlReconciler;
|
||||
this.jpqlReconciler = jpqlReconciler;
|
||||
this.sqlReconciler = sqlReconciler;
|
||||
|
||||
this.sqlReconcilers = new LinkedHashMap<>();
|
||||
this.sqlReconcilers.put(SqlType.MYSQL, new AntlrReconcilerWithSpel("MySQL", MySqlParser.class, MySqlLexer.class, "sqlStatements", QueryProblemType.SQL_SYNTAX, spelReconciler, MySqlLexer.SPEL));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +95,8 @@ public class QueryJdtAstReconciler implements JdtAstReconciler {
|
||||
|
||||
if (queryExpression != null) {
|
||||
if (isNative) {
|
||||
reconcileExpression(sqlReconciler, queryExpression, problemCollector);
|
||||
final Expression expr = queryExpression;
|
||||
getSqlReconciler(project).ifPresent(r -> reconcileExpression(r, expr, problemCollector));
|
||||
} else {
|
||||
reconcileExpression(getQueryReconciler(project), queryExpression, problemCollector);
|
||||
}
|
||||
@@ -156,5 +165,12 @@ public class QueryJdtAstReconciler implements JdtAstReconciler {
|
||||
public ProblemType getProblemType() {
|
||||
return QueryProblemType.JPQL_SYNTAX;
|
||||
}
|
||||
|
||||
private Optional<Reconciler> getSqlReconciler(IJavaProject project) {
|
||||
if (SpringProjectUtil.hasDependencyStartingWith(project, "mysql-connector", null)) {
|
||||
return Optional.of(sqlReconcilers.get(SqlType.MYSQL));
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.ERROR;
|
||||
import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.IGNORE;
|
||||
|
||||
import org.springframework.ide.vscode.boot.common.SpringProblemCategories;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemCategory;
|
||||
@@ -22,7 +21,7 @@ public enum QueryProblemType implements ProblemType {
|
||||
|
||||
JPQL_SYNTAX(ERROR, "Syntax", "JPQL Query Syntax"),
|
||||
HQL_SYNTAX(ERROR, "Syntax", "HQL Query Syntax"),
|
||||
SQL_SYNTAX(IGNORE, "Syntax", "SQL Query Syntax");
|
||||
SQL_SYNTAX(ERROR, "Syntax", "SQL Query Syntax");
|
||||
|
||||
private final ProblemSeverity defaultSeverity;
|
||||
private String description;
|
||||
|
||||
@@ -1,110 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Broadcom, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import java.util.BitSet;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.antlr.v4.runtime.ANTLRErrorListener;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.ConsoleErrorListener;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.RecognitionException;
|
||||
import org.antlr.v4.runtime.Recognizer;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
import org.antlr.v4.runtime.tree.ErrorNode;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelReconciler;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl;
|
||||
import org.springframework.ide.vscode.parser.sql.MySqlLexer;
|
||||
import org.springframework.ide.vscode.parser.sql.MySqlParser;
|
||||
import org.springframework.ide.vscode.parser.sql.MySqlParserBaseListener;
|
||||
|
||||
public class SqlReconciler implements Reconciler {
|
||||
|
||||
private final Optional<SpelReconciler> spelReconciler;
|
||||
|
||||
public SqlReconciler(Optional<SpelReconciler> spelReconciler) {
|
||||
this.spelReconciler = spelReconciler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconcile(String text, int startPosition, IProblemCollector problemCollector) {
|
||||
MySqlLexer lexer = new MySqlLexer(CharStreams.fromString(text));
|
||||
CommonTokenStream antlrTokens = new CommonTokenStream(lexer);
|
||||
MySqlParser parser = new MySqlParser(antlrTokens);
|
||||
|
||||
lexer.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
parser.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
|
||||
parser.addErrorListener(new ANTLRErrorListener() {
|
||||
|
||||
@Override
|
||||
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
|
||||
String msg, RecognitionException e) {
|
||||
Token token = (Token) offendingSymbol;
|
||||
int offset = token.getStartIndex();
|
||||
int length = token.getStopIndex() - token.getStartIndex() + 1;
|
||||
if (token.getStartIndex() >= token.getStopIndex()) {
|
||||
offset = token.getStartIndex() - token.getCharPositionInLine();
|
||||
length = token.getCharPositionInLine() + 1;
|
||||
}
|
||||
problemCollector.accept(new ReconcileProblemImpl(QueryProblemType.SQL_SYNTAX, "SQL: " + msg, startPosition + offset, length));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, int prediction,
|
||||
ATNConfigSet configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex,
|
||||
BitSet conflictingAlts, ATNConfigSet configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, boolean exact,
|
||||
BitSet ambigAlts, ATNConfigSet configs) {
|
||||
}
|
||||
});
|
||||
|
||||
// Reconcile embedded SPEL
|
||||
parser.addParseListener(new MySqlParserBaseListener() {
|
||||
|
||||
private void processTerminal(TerminalNode node) {
|
||||
if (node.getSymbol().getType() == MySqlParser.SPEL) {
|
||||
spelReconciler.ifPresent(r -> JpqlReconciler.reconcileEmbeddedSpelNode(node, startPosition, r, problemCollector));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitTerminal(TerminalNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitErrorNode(ErrorNode node) {
|
||||
processTerminal(node);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
parser.sqlStatements();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Broadcom, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
public enum SqlType {
|
||||
|
||||
MYSQL
|
||||
|
||||
}
|
||||
@@ -10,29 +10,21 @@
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.spel;
|
||||
|
||||
import java.util.BitSet;
|
||||
|
||||
import org.antlr.v4.runtime.ANTLRErrorListener;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.ConsoleErrorListener;
|
||||
import org.antlr.v4.runtime.Parser;
|
||||
import org.antlr.v4.runtime.RecognitionException;
|
||||
import org.antlr.v4.runtime.Recognizer;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
import org.springframework.ide.vscode.boot.java.SpelProblemType;
|
||||
import org.springframework.ide.vscode.boot.java.handlers.Reconciler;
|
||||
import org.springframework.ide.vscode.boot.java.data.jpa.queries.AntlrReconciler;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
|
||||
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl;
|
||||
import org.springframework.ide.vscode.parser.spel.SpelLexer;
|
||||
import org.springframework.ide.vscode.parser.spel.SpelParser;
|
||||
|
||||
public class SpelReconciler implements Reconciler {
|
||||
|
||||
private boolean enabled = true;
|
||||
public class SpelReconciler extends AntlrReconciler {
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
public SpelReconciler() {
|
||||
super("SPEL", SpelParser.class, SpelLexer.class, "spelExpr", SpelProblemType.JAVA_SPEL_EXPRESSION_SYNTAX);
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean spelExpressionValidationEnabled) {
|
||||
this.enabled = spelExpressionValidationEnabled;
|
||||
}
|
||||
@@ -42,45 +34,7 @@ public class SpelReconciler implements Reconciler {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
SpelLexer lexer = new SpelLexer(CharStreams.fromString(text));
|
||||
CommonTokenStream antlrTokens = new CommonTokenStream(lexer);
|
||||
SpelParser parser = new SpelParser(antlrTokens);
|
||||
|
||||
lexer.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
parser.removeErrorListener(ConsoleErrorListener.INSTANCE);
|
||||
|
||||
parser.addErrorListener(new ANTLRErrorListener() {
|
||||
|
||||
@Override
|
||||
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine,
|
||||
String msg, RecognitionException e) {
|
||||
Token token = (Token) offendingSymbol;
|
||||
int offset = token.getStartIndex();
|
||||
int length = token.getStopIndex() - token.getStartIndex() + 1;
|
||||
if (token.getStartIndex() >= token.getStopIndex()) {
|
||||
offset = token.getStartIndex() - token.getCharPositionInLine();
|
||||
length = token.getCharPositionInLine() + 1;
|
||||
}
|
||||
problemCollector.accept(new ReconcileProblemImpl(SpelProblemType.JAVA_SPEL_EXPRESSION_SYNTAX, "SPEL: " + msg, startPosition + offset, length));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, int prediction,
|
||||
ATNConfigSet configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex,
|
||||
BitSet conflictingAlts, ATNConfigSet configs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, boolean exact,
|
||||
BitSet ambigAlts, ATNConfigSet configs) {
|
||||
}
|
||||
});
|
||||
|
||||
parser.spelExpr();
|
||||
super.reconcile(text, startPosition, problemCollector);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@
|
||||
"code": "SQL_SYNTAX",
|
||||
"label": "SQL Query Syntax",
|
||||
"description": "Syntax",
|
||||
"defaultSeverity": "IGNORE"
|
||||
"defaultSeverity": "ERROR"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -151,4 +151,41 @@ public class HqlSemanticTokensTest {
|
||||
assertThat(tokens.size()).isEqualTo(20);
|
||||
}
|
||||
|
||||
@Test
|
||||
void query_with_complex_SPEL_Tokens() {
|
||||
provider = new HqlSemanticTokens(Optional.of(new SpelSemanticTokens()));
|
||||
List<SemanticTokenData> tokens = provider.computeTokens("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:#{someBean.someProperty != null ? someBean.someProperty : 'default'}", 0);
|
||||
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0])); // SELECT
|
||||
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 12, "variable", new String[0])); // owner
|
||||
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(13, 17, "keyword", new String[0])); // FROM
|
||||
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(18, 23, "class", new String[0])); // Owner
|
||||
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(24, 29, "variable", new String[0])); // owner
|
||||
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(30, 34, "keyword", new String[0])); // left
|
||||
assertThat(tokens.get(6)).isEqualTo(new SemanticTokenData(35, 39, "keyword", new String[0])); // join
|
||||
assertThat(tokens.get(7)).isEqualTo(new SemanticTokenData(40, 45, "keyword", new String[0])); // fetch
|
||||
assertThat(tokens.get(8)).isEqualTo(new SemanticTokenData(46, 51, "variable", new String[0])); // owner
|
||||
assertThat(tokens.get(9)).isEqualTo(new SemanticTokenData(51, 52, "operator", new String[0])); // .
|
||||
assertThat(tokens.get(10)).isEqualTo(new SemanticTokenData(52, 56, "method", new String[0])); // pets
|
||||
assertThat(tokens.get(11)).isEqualTo(new SemanticTokenData(57, 62, "keyword", new String[0])); // WHERE
|
||||
assertThat(tokens.get(12)).isEqualTo(new SemanticTokenData(63, 68, "variable", new String[0])); // owner
|
||||
assertThat(tokens.get(13)).isEqualTo(new SemanticTokenData(68, 69, "operator", new String[0])); // .
|
||||
assertThat(tokens.get(14)).isEqualTo(new SemanticTokenData(69, 71, "method", new String[0])); // id
|
||||
assertThat(tokens.get(15)).isEqualTo(new SemanticTokenData(72, 73, "operator", new String[0])); // =
|
||||
assertThat(tokens.get(16)).isEqualTo(new SemanticTokenData(73, 74, "operator", new String[0])); // :
|
||||
assertThat(tokens.get(17)).isEqualTo(new SemanticTokenData(74, 76, "operator", new String[0])); // #{
|
||||
assertThat(tokens.get(18)).isEqualTo(new SemanticTokenData(76, 84, "variable", new String[0])); // someBean
|
||||
assertThat(tokens.get(19)).isEqualTo(new SemanticTokenData(84, 85, "operator", new String[0])); // .
|
||||
assertThat(tokens.get(20)).isEqualTo(new SemanticTokenData(85, 97, "property", new String[0])); // someProperty
|
||||
assertThat(tokens.get(21)).isEqualTo(new SemanticTokenData(98, 100, "operator", new String[0])); // !=
|
||||
assertThat(tokens.get(22)).isEqualTo(new SemanticTokenData(101, 105, "keyword", new String[0])); // null
|
||||
assertThat(tokens.get(23)).isEqualTo(new SemanticTokenData(106, 107, "operator", new String[0])); // ?
|
||||
assertThat(tokens.get(24)).isEqualTo(new SemanticTokenData(108, 116, "variable", new String[0])); // someBean
|
||||
assertThat(tokens.get(25)).isEqualTo(new SemanticTokenData(116, 117, "operator", new String[0])); // .
|
||||
assertThat(tokens.get(26)).isEqualTo(new SemanticTokenData(117, 129, "property", new String[0])); // someProperty
|
||||
assertThat(tokens.get(27)).isEqualTo(new SemanticTokenData(130, 131, "operator", new String[0])); // :
|
||||
assertThat(tokens.get(28)).isEqualTo(new SemanticTokenData(132, 141, "string", new String[0])); // 'default'
|
||||
assertThat(tokens.get(29)).isEqualTo(new SemanticTokenData(141, 142, "operator", new String[0])); // }
|
||||
|
||||
assertThat(tokens.size()).isEqualTo(30);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class JdtDataQuerySemanticTokensProviderTest {
|
||||
|
||||
@BeforeEach
|
||||
public void setup() throws Exception {
|
||||
jp = projects.mavenProject("spring-modulith-example-full");
|
||||
jp = projects.mavenProject("boot-sql");
|
||||
}
|
||||
|
||||
private List<SemanticTokenData> computeTokens(CompilationUnit cu) {
|
||||
|
||||
@@ -72,7 +72,7 @@ public class JpqlSemanticTokensTest {
|
||||
|
||||
@Test
|
||||
void query_with_parameter() {
|
||||
List<SemanticTokenData> tokens = provider.computeTokens("SELECT f from Student f LEFT JOIN f.classTbls s WHERE s.ClassName = :className%", 0);
|
||||
List<SemanticTokenData> tokens = provider.computeTokens("SELECT f from Student f LEFT JOIN f.classTbls s WHERE s.ClassName = :className", 0);
|
||||
|
||||
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0])); // SELECT
|
||||
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 8, "variable", new String[0])); // f
|
||||
@@ -92,9 +92,8 @@ public class JpqlSemanticTokensTest {
|
||||
assertThat(tokens.get(15)).isEqualTo(new SemanticTokenData(66, 67, "operator", new String[0])); // =
|
||||
assertThat(tokens.get(16)).isEqualTo(new SemanticTokenData(68, 69, "operator", new String[0])); // :
|
||||
assertThat(tokens.get(17)).isEqualTo(new SemanticTokenData(69, 78, "parameter", new String[0])); // className
|
||||
assertThat(tokens.get(18)).isEqualTo(new SemanticTokenData(78, 79, "operator", new String[0])); // %
|
||||
|
||||
assertThat(tokens.size()).isEqualTo(19);
|
||||
assertThat(tokens.size()).isEqualTo(18);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2024 Broadcom, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Broadcom, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.vscode.boot.java.data.jpa.queries;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.ide.vscode.boot.java.spel.SpelSemanticTokens;
|
||||
import org.springframework.ide.vscode.commons.languageserver.semantic.tokens.SemanticTokenData;
|
||||
|
||||
public class MySqlSemanticTokensTest {
|
||||
|
||||
private MySqlSemanticTokens provider;
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
provider = new MySqlSemanticTokens(Optional.of(new SpelSemanticTokens()));
|
||||
}
|
||||
|
||||
@Test
|
||||
void simple() {
|
||||
List<SemanticTokenData> tokens = provider.computeTokens("SELECT * from fn_module_candidates()", 0);
|
||||
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0]));
|
||||
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 8, "operator", new String[0]));
|
||||
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(9, 13, "keyword", new String[0]));
|
||||
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(14, 34, "variable", new String[0]));
|
||||
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(34, 35, "operator", new String[0]));
|
||||
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(35, 36, "operator", new String[0]));
|
||||
|
||||
assertThat(tokens.size()).isEqualTo(6);
|
||||
}
|
||||
|
||||
@Test
|
||||
void parametersInQuery() {
|
||||
List<SemanticTokenData> tokens = provider.computeTokens("DELETE FROM component_document WHERE item_document_id = :itemDocumentId", 0);
|
||||
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0]));
|
||||
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 11, "keyword", new String[0]));
|
||||
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(12, 30, "variable", new String[0]));
|
||||
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(31, 36, "keyword", new String[0]));
|
||||
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(37, 53, "variable", new String[0]));
|
||||
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(54, 55, "operator", new String[0]));
|
||||
assertThat(tokens.get(6)).isEqualTo(new SemanticTokenData(56, 57, "operator", new String[0]));
|
||||
assertThat(tokens.get(7)).isEqualTo(new SemanticTokenData(57, 71, "parameter", new String[0]));
|
||||
|
||||
assertThat(tokens.size()).isEqualTo(8);
|
||||
}
|
||||
|
||||
@Test
|
||||
void spelInQuery() {
|
||||
List<SemanticTokenData> tokens = provider.computeTokens("DELETE FROM component_document WHERE item_document_id = :#{someBean}", 0);
|
||||
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0]));
|
||||
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 11, "keyword", new String[0]));
|
||||
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(12, 30, "variable", new String[0]));
|
||||
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(31, 36, "keyword", new String[0]));
|
||||
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(37, 53, "variable", new String[0]));
|
||||
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(54, 55, "operator", new String[0]));
|
||||
assertThat(tokens.get(6)).isEqualTo(new SemanticTokenData(56, 57, "operator", new String[0]));
|
||||
assertThat(tokens.get(7)).isEqualTo(new SemanticTokenData(57, 59, "operator", new String[0]));
|
||||
assertThat(tokens.get(8)).isEqualTo(new SemanticTokenData(59, 67, "variable", new String[0]));
|
||||
assertThat(tokens.get(9)).isEqualTo(new SemanticTokenData(67, 68, "operator", new String[0]));
|
||||
|
||||
assertThat(tokens.size()).isEqualTo(10);
|
||||
}
|
||||
|
||||
@Test
|
||||
void complexSpelInQuery() {
|
||||
List<SemanticTokenData> tokens = provider.computeTokens("DELETE FROM component_document WHERE item_document_id = :#{someBean.someProperty != null ? someBean.someProperty : 'default'}", 0);
|
||||
assertThat(tokens.get(0)).isEqualTo(new SemanticTokenData(0, 6, "keyword", new String[0]));
|
||||
assertThat(tokens.get(1)).isEqualTo(new SemanticTokenData(7, 11, "keyword", new String[0]));
|
||||
assertThat(tokens.get(2)).isEqualTo(new SemanticTokenData(12, 30, "variable", new String[0]));
|
||||
assertThat(tokens.get(3)).isEqualTo(new SemanticTokenData(31, 36, "keyword", new String[0]));
|
||||
assertThat(tokens.get(4)).isEqualTo(new SemanticTokenData(37, 53, "variable", new String[0]));
|
||||
assertThat(tokens.get(5)).isEqualTo(new SemanticTokenData(54, 55, "operator", new String[0]));
|
||||
assertThat(tokens.get(6)).isEqualTo(new SemanticTokenData(56, 57, "operator", new String[0])); // :
|
||||
assertThat(tokens.get(7)).isEqualTo(new SemanticTokenData(57, 59, "operator", new String[0])); // #{
|
||||
assertThat(tokens.get(8)).isEqualTo(new SemanticTokenData(59, 67, "variable", new String[0])); // someBean
|
||||
assertThat(tokens.get(9)).isEqualTo(new SemanticTokenData(67, 68, "operator", new String[0])); // .
|
||||
assertThat(tokens.get(10)).isEqualTo(new SemanticTokenData(68, 80, "property", new String[0])); // someProperty
|
||||
assertThat(tokens.get(11)).isEqualTo(new SemanticTokenData(81, 83, "operator", new String[0])); // !=
|
||||
assertThat(tokens.get(12)).isEqualTo(new SemanticTokenData(84, 88, "keyword", new String[0])); // null
|
||||
assertThat(tokens.get(13)).isEqualTo(new SemanticTokenData(89, 90, "operator", new String[0])); // ?
|
||||
assertThat(tokens.get(14)).isEqualTo(new SemanticTokenData(91, 99, "variable", new String[0])); // someBean
|
||||
assertThat(tokens.get(15)).isEqualTo(new SemanticTokenData(99, 100, "operator", new String[0])); // .
|
||||
assertThat(tokens.get(16)).isEqualTo(new SemanticTokenData(100, 112, "property", new String[0])); // someProperty
|
||||
assertThat(tokens.get(17)).isEqualTo(new SemanticTokenData(113, 114, "operator", new String[0])); // :
|
||||
assertThat(tokens.get(18)).isEqualTo(new SemanticTokenData(115, 124, "string", new String[0])); // 'default'
|
||||
assertThat(tokens.get(19)).isEqualTo(new SemanticTokenData(124, 125, "operator", new String[0])); // }
|
||||
|
||||
assertThat(tokens.size()).isEqualTo(20);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class QueryReconcilerTest {
|
||||
public void setup() throws Exception {
|
||||
harness.intialize(null);
|
||||
|
||||
directory = new File(ProjectsHarness.class.getResource("/test-projects/spring-modulith-example-full/").toURI());
|
||||
directory = new File(ProjectsHarness.class.getResource("/test-projects/boot-sql/").toURI());
|
||||
|
||||
String projectDir = directory.toURI().toString();
|
||||
|
||||
@@ -226,7 +226,7 @@ public class QueryReconcilerTest {
|
||||
String docUri = directory.toPath().resolve("src/main/java/example/demo/OwnerRepository.java").toUri()
|
||||
.toString();
|
||||
Editor editor = harness.newEditor(LanguageId.JAVA, source, docUri);
|
||||
editor.assertProblems("SELECTX|SQL: mismatched input 'SELECTX' expecting {'ALTER',");
|
||||
editor.assertProblems("SELECTX|MySQL: mismatched input 'SELECTX' expecting {'ALTER',");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
||||
308
headless-services/spring-boot-language-server/src/test/resources/test-projects/boot-sql/mvnw
vendored
Executable file
308
headless-services/spring-boot-language-server/src/test/resources/test-projects/boot-sql/mvnw
vendored
Executable file
@@ -0,0 +1,308 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /usr/local/etc/mavenrc ] ; then
|
||||
. /usr/local/etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "$(uname)" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME
|
||||
else
|
||||
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=$(java-config --jre-home)
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --unix "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
|
||||
fi
|
||||
|
||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)"
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="$(which javac)"
|
||||
if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=$(which readlink)
|
||||
if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac"
|
||||
else
|
||||
javaExecutable="$(readlink -f "\"$javaExecutable\"")"
|
||||
fi
|
||||
javaHome="$(dirname "\"$javaExecutable\"")"
|
||||
javaHome=$(expr "$javaHome" : '\(.*\)/bin')
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=$(cd "$wdir/.." || exit 1; pwd)
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
printf '%s' "$(cd "$basedir" || exit 1; pwd)"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
# Remove \r in case we run on Windows within Git Bash
|
||||
# and check out the repository with auto CRLF management
|
||||
# enabled. Otherwise, we may read lines that are delimited with
|
||||
# \r\n and produce $'-Xarg\r' rather than -Xarg due to word
|
||||
# splitting rules.
|
||||
tr -s '\r\n' ' ' < "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
log() {
|
||||
if [ "$MVNW_VERBOSE" = true ]; then
|
||||
printf '%s\n' "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=$(find_maven_basedir "$(dirname "$0")")
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR
|
||||
log "$MAVEN_PROJECTBASEDIR"
|
||||
|
||||
##########################################################################################
|
||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
##########################################################################################
|
||||
wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar"
|
||||
if [ -r "$wrapperJarPath" ]; then
|
||||
log "Found $wrapperJarPath"
|
||||
else
|
||||
log "Couldn't find $wrapperJarPath, downloading it ..."
|
||||
|
||||
if [ -n "$MVNW_REPOURL" ]; then
|
||||
wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
else
|
||||
wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
fi
|
||||
while IFS="=" read -r key value; do
|
||||
# Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' )
|
||||
safeValue=$(echo "$value" | tr -d '\r')
|
||||
case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
log "Downloading from: $wrapperUrl"
|
||||
|
||||
if $cygwin; then
|
||||
wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath")
|
||||
fi
|
||||
|
||||
if command -v wget > /dev/null; then
|
||||
log "Found wget ... using wget"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
else
|
||||
wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
elif command -v curl > /dev/null; then
|
||||
log "Found curl ... using curl"
|
||||
[ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent"
|
||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||
curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
else
|
||||
curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
else
|
||||
log "Falling back to using Java to download"
|
||||
javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||
javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class"
|
||||
# For Cygwin, switch paths to Windows format before running javac
|
||||
if $cygwin; then
|
||||
javaSource=$(cygpath --path --windows "$javaSource")
|
||||
javaClass=$(cygpath --path --windows "$javaClass")
|
||||
fi
|
||||
if [ -e "$javaSource" ]; then
|
||||
if [ ! -e "$javaClass" ]; then
|
||||
log " - Compiling MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/javac" "$javaSource")
|
||||
fi
|
||||
if [ -e "$javaClass" ]; then
|
||||
log " - Running MavenWrapperDownloader.java ..."
|
||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
##########################################################################################
|
||||
# End of extension
|
||||
##########################################################################################
|
||||
|
||||
# If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
wrapperSha256Sum=""
|
||||
while IFS="=" read -r key value; do
|
||||
case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;;
|
||||
esac
|
||||
done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties"
|
||||
if [ -n "$wrapperSha256Sum" ]; then
|
||||
wrapperSha256Result=false
|
||||
if command -v sha256sum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
elif command -v shasum > /dev/null; then
|
||||
if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then
|
||||
wrapperSha256Result=true
|
||||
fi
|
||||
else
|
||||
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available."
|
||||
echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties."
|
||||
exit 1
|
||||
fi
|
||||
if [ $wrapperSha256Result = false ]; then
|
||||
echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2
|
||||
echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2
|
||||
echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME")
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=$(cygpath --path --windows "$CLASSPATH")
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR")
|
||||
fi
|
||||
|
||||
# Provide a "standardized" way to retrieve the CLI args that will
|
||||
# work with both Windows and non-Windows executions.
|
||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*"
|
||||
export MAVEN_CMD_LINE_ARGS
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
# shellcheck disable=SC2086 # safe args
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
$MAVEN_DEBUG_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
205
headless-services/spring-boot-language-server/src/test/resources/test-projects/boot-sql/mvnw.cmd
vendored
Normal file
205
headless-services/spring-boot-language-server/src/test/resources/test-projects/boot-sql/mvnw.cmd
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Apache Maven Wrapper startup batch script, version 3.2.0
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM set title of command window
|
||||
title %0
|
||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
|
||||
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B
|
||||
)
|
||||
|
||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||
if exist %WRAPPER_JAR% (
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Found %WRAPPER_JAR%
|
||||
)
|
||||
) else (
|
||||
if not "%MVNW_REPOURL%" == "" (
|
||||
SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar"
|
||||
)
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||
echo Downloading from: %WRAPPER_URL%
|
||||
)
|
||||
|
||||
powershell -Command "&{"^
|
||||
"$webclient = new-object System.Net.WebClient;"^
|
||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||
"}"^
|
||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^
|
||||
"}"
|
||||
if "%MVNW_VERBOSE%" == "true" (
|
||||
echo Finished downloading %WRAPPER_JAR%
|
||||
)
|
||||
)
|
||||
@REM End of extension
|
||||
|
||||
@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file
|
||||
SET WRAPPER_SHA_256_SUM=""
|
||||
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||
IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B
|
||||
)
|
||||
IF NOT %WRAPPER_SHA_256_SUM%=="" (
|
||||
powershell -Command "&{"^
|
||||
"$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^
|
||||
"If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^
|
||||
" Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^
|
||||
" Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^
|
||||
" Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^
|
||||
" exit 1;"^
|
||||
"}"^
|
||||
"}"
|
||||
if ERRORLEVEL 1 goto error
|
||||
)
|
||||
|
||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||
@REM work with both Windows and non-Windows executions.
|
||||
set MAVEN_CMD_LINE_ARGS=%*
|
||||
|
||||
%MAVEN_JAVA_EXE% ^
|
||||
%JVM_CONFIG_MAVEN_PROPS% ^
|
||||
%MAVEN_OPTS% ^
|
||||
%MAVEN_DEBUG_OPTS% ^
|
||||
-classpath %WRAPPER_JAR% ^
|
||||
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
|
||||
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
|
||||
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%"=="on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
|
||||
|
||||
cmd /C exit /B %ERROR_CODE%
|
||||
@@ -0,0 +1,48 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.2.2</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<artifactId>boot-sql</artifactId>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1199,7 +1199,7 @@
|
||||
},
|
||||
"spring-boot.ls.problem.data-query.SQL_SYNTAX": {
|
||||
"type": "string",
|
||||
"default": "IGNORE",
|
||||
"default": "ERROR",
|
||||
"description": "Syntax",
|
||||
"enum": [
|
||||
"IGNORE",
|
||||
|
||||
Reference in New Issue
Block a user