mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-27144 Spring 3.0 API added;generics & vararg support fix
This commit is contained in:
@@ -18,12 +18,10 @@ package com.intellij.patterns;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiParameter;
|
||||
import com.intellij.psi.PsiParameterList;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.SuperMethodsSearch;
|
||||
import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -67,13 +65,28 @@ public class PsiMethodPattern extends PsiMemberPattern<PsiMethod,PsiMethodPatter
|
||||
if (dotsIndex > 0) {
|
||||
final PsiParameter[] psiParameters = parameterList.getParameters();
|
||||
for (int i = 0; i < dotsIndex; i++) {
|
||||
if (!Comparing.equal("?", types[i]) && !types[i].equals(psiParameters[i].getType().getCanonicalText())) {
|
||||
if (!Comparing.equal("?", types[i]) && !typeEquivalent(psiParameters[i].getType(), types[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean typeEquivalent(PsiType type, String expectedText) {
|
||||
final PsiType erasure = TypeConversionUtil.erasure(type);
|
||||
final String text;
|
||||
if (erasure instanceof PsiEllipsisType && expectedText.endsWith("[]")) {
|
||||
text = ((PsiEllipsisType)erasure).getComponentType().getCanonicalText() + "[]";
|
||||
}
|
||||
else if (erasure instanceof PsiArrayType && expectedText.endsWith("...")) {
|
||||
text = ((PsiArrayType)erasure).getComponentType().getCanonicalText() +"...";
|
||||
}
|
||||
else {
|
||||
text = erasure.getCanonicalText();
|
||||
}
|
||||
return expectedText.equals(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "org.springframework.jdbc.core.BatchPreparedStatementSetter").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String[]").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("execute").withParameters("java.lang.String").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("execute").withParameters("java.lang.String", "org.springframework.jdbc.core.CallableStatementCallback").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("execute").withParameters("java.lang.String", "org.springframework.jdbc.core.PreparedStatementCallback").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "java.lang.Object[]", "int[]", "org.springframework.jdbc.core.ResultSetExtractor").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "java.lang.Object[]", "int[]", "org.springframework.jdbc.core.RowCallbackHandler").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
|
||||
@@ -220,14 +221,40 @@
|
||||
</injection>
|
||||
<injection language="SQL" injector-id="java">
|
||||
<display-name>SimpleJdbcOperations (org.springframework.jdbc.core.simple)</display-name>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper<T>", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "java.util.List").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "java.util.List", "int[]").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "java.util.Map[]").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource[]").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForInt").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForInt").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForInt").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForList").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForList").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForList").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForLong").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForLong").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForLong").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForMap").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class<T>", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper<T>", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForMap").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForMap").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
|
||||
</injection>
|
||||
<injection language="SQL" injector-id="java">
|
||||
<display-name>SqlCall.SqlCall (org.springframework.jdbc.object)</display-name>
|
||||
@@ -239,6 +266,12 @@
|
||||
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]", "java.lang.Class").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
|
||||
</injection>
|
||||
<injection language="SQL" injector-id="java">
|
||||
<display-name>SqlFunction.SqlFunction (org.springframework.jdbc.object)</display-name>
|
||||
<place disabled="true"><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
|
||||
<place disabled="true"><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
|
||||
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]", "java.lang.Class").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
|
||||
</injection>
|
||||
<injection language="SQL" injector-id="java">
|
||||
<display-name>SqlOperation.newPreparedStatementCreator (org.springframework.jdbc.object)</display-name>
|
||||
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("newPreparedStatementCreator").withParameters("java.lang.String", "java.lang.Object[]").definedInClass("org.springframework.jdbc.object.SqlOperation"))]]></place>
|
||||
|
||||
Reference in New Issue
Block a user