Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
/**
* @author Daniel Espendiller <daniel@espendiller.net>
*
* @deprecated Use core features
*/
@Deprecated
public interface GotoCompletionContributor {
@Nullable
GotoCompletionProvider getProvider(@NotNull PsiElement psiElement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
/**
* @author Daniel Espendiller <daniel@espendiller.net>
*
* @deprecated Use core features
*/
@Deprecated
public abstract class GotoCompletionProvider implements GotoCompletionProviderInterfaceEx {
@NotNull
private final PsiElement element;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

/**
* @author Daniel Espendiller <daniel@espendiller.net>
*
* @deprecated Use core features
*/
@Deprecated
public interface GotoCompletionRegistrar {
void register(@NotNull GotoCompletionRegistrarParameter registrar);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
/**
* @author Daniel Espendiller <daniel@espendiller.net>
*
* @deprecated Use core features
*/
@Deprecated
public interface GotoCompletionRegistrarParameter {
void register(@NotNull ElementPattern<? extends PsiElement> pattern, GotoCompletionContributor contributor);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public String getAlias() {
}

public Collection<PsiElement> getPsiTargets() {
return field == null ? Collections.EMPTY_LIST : field.getTargets();
return field == null ? Collections.emptyList() : field.getTargets();
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public enum InstanceType {
}

@Nullable
@SuppressWarnings("unchecked")
private static <T extends PsiElement> T getLastParentOfType(@Nullable PsiElement element, @NotNull Class<T> aClass) {
if (element == null) return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull Psi
}

@Override
@SuppressWarnings("deprecation")
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement psiElement) throws IncorrectOperationException {

YAMLKeyValue serviceKeyValue = YamlHelper.findServiceInContext(psiElement);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public YamlUpdateArgumentServicesCallback(Project project, YAMLKeyValue argument
}

@Override
@SuppressWarnings("deprecation")
public void insert(List<String> items) {

YAMLValue yamlCompoundValue = argumentsKeyValue.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public int getStatusCode() {

@Nullable
@Override
@SuppressWarnings("unchecked")
public <T> T getCollector(Class<T> classFactory) {
for (Object collector : collectors) {
if(classFactory.isAssignableFrom(collector.getClass())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public int getStatusCode() {
}
}

@SuppressWarnings("unchecked")
public <T> T getCollector(Class<T> classFactory) {
for (Object collector : collectors) {
if(classFactory.isAssignableFrom(collector.getClass())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.indexing.FileBasedIndex;
import com.jetbrains.php.config.PhpLanguageLevel;
import com.jetbrains.php.lang.parser.PhpElementTypes;
import com.jetbrains.php.lang.psi.PhpFile;
import com.jetbrains.php.lang.psi.PhpPsiUtil;
Expand Down Expand Up @@ -390,7 +391,7 @@ public static PsiElement[] getMethodsOnControllerShortcut(@NotNull Project proje
if(controllerServiceAction != null) {
return new PsiElement[] {controllerServiceAction.getMethod()};
}
} else if(PhpNameUtil.isValidNamespaceFullName(controllerName, true)) {
} else if(PhpNameUtil.isValidNamespaceFullName(controllerName, true, PhpLanguageLevel.current(project))) {
// FooBundle\Controller\BarController (__invoke)
Method invoke = PhpElementsUtil.getClassMethod(project, controllerName, "__invoke");
if(invoke != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
* @author Daniel Espendiller <daniel@espendiller.net>
*/
public class TwigPattern {
private static final ElementPattern[] PARAMETER_WHITE_LIST = new ElementPattern[]{
@SuppressWarnings("unchecked")
private static final ElementPattern<?>[] PARAMETER_WHITE_LIST = new ElementPattern[]{
PlatformPatterns.psiElement(PsiWhiteSpace.class),
PlatformPatterns.psiElement(TwigTokenTypes.WHITE_SPACE),
PlatformPatterns.psiElement(TwigTokenTypes.NUMBER),
Expand Down Expand Up @@ -939,12 +940,12 @@ public static ElementPattern<PsiElement> getTransDefaultDomainPattern() {
* transchoice(2, null, 'bar')
*/
public static ElementPattern<PsiElement> getTransDomainPattern() {
ElementPattern[] whitespace = {
ElementPattern<?>[] whitespace = {
PlatformPatterns.psiElement(PsiWhiteSpace.class),
PlatformPatterns.psiElement(TwigTokenTypes.WHITE_SPACE)
};

ElementPattern[] placeholder = {
ElementPattern<?>[] placeholder = {
PlatformPatterns.psiElement(PsiWhiteSpace.class),
PlatformPatterns.psiElement(TwigTokenTypes.WHITE_SPACE),
PlatformPatterns.psiElement(TwigTokenTypes.IDENTIFIER),
Expand Down Expand Up @@ -1097,7 +1098,9 @@ public static ElementPattern<PsiComment> getTwigTypeDocBlockPattern() {
patterns.add(PlatformPatterns.psiElement(TwigTokenTypes.COMMENT_TEXT).withText(PlatformPatterns.string().matches(s)).withLanguage(TwigLanguage.INSTANCE));
}

return PlatformPatterns.or(patterns.toArray(new ElementPattern[0]));
@SuppressWarnings("unchecked")
final ElementPattern<PsiComment>[] array = patterns.toArray(new ElementPattern[0]);
return PlatformPatterns.or(array);
}

/**
Expand Down Expand Up @@ -1574,7 +1577,7 @@ public static ElementPattern<PsiElement> getVariableTypePattern() {
@NotNull
public static PsiElementPattern getFirstFunctionParameterAsStringPattern() {
// string wrapped elements
ElementPattern[] elementPatterns = {
ElementPattern<?>[] elementPatterns = {
PlatformPatterns.psiElement(TwigTokenTypes.WHITE_SPACE),
PlatformPatterns.psiElement(PsiWhiteSpace.class),
PlatformPatterns.psiElement(TwigTokenTypes.SINGLE_QUOTE),
Expand All @@ -1592,7 +1595,7 @@ public static PsiElementPattern getFirstFunctionParameterAsStringPattern() {
@NotNull
public static PsiElementPattern getParameterAsStringPattern() {
// string wrapped elements
ElementPattern[] elementPatterns = {
ElementPattern<?>[] elementPatterns = {
PlatformPatterns.psiElement(TwigTokenTypes.WHITE_SPACE),
PlatformPatterns.psiElement(PsiWhiteSpace.class),
PlatformPatterns.psiElement(TwigTokenTypes.SINGLE_QUOTE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class MethodParameterDialog extends JDialog {

private final Project project;

static class ComboBoxRenderer extends ColoredListCellRenderer {
static class ComboBoxRenderer extends ColoredListCellRenderer<String> {
@Override
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
append((String) value);
protected void customizeCellRenderer(JList<? extends String> list, String value, int index, boolean selected, boolean hasFocus) {
append(value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static public Map<String, Pair<PsiElement, PsiElement>> getArrayKeyValueMapWithK
continue;
}

keys.put(key, new Pair(arrayHashElement.getKey(), arrayHashElement.getValue()));
keys.put(key, new Pair<>(arrayHashElement.getKey(), arrayHashElement.getValue()));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @No
return new PsiReference[0];
}

@SuppressWarnings("unchecked")
private PsiReference[] getPsiReferenceBase(PsiElement psiElement) {

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public static int getParameterIndexValue(@Nullable PsiElement parameterListChild
}

@Nullable
@SuppressWarnings("unchecked")
public static <T extends PsiElement> T getNextSiblingOfType(@Nullable PsiElement sibling, ElementPattern<PsiElement> pattern) {
if (sibling == null) return null;
for (PsiElement child = sibling.getNextSibling(); child != null; child = child.getNextSibling()) {
Expand All @@ -170,6 +171,7 @@ public static <T extends PsiElement> T getNextSiblingOfType(@Nullable PsiElement
}

@NotNull
@SuppressWarnings("unchecked")
public static <T extends PsiElement> Collection<T> getNextSiblingOfTypes(@Nullable PsiElement sibling, ElementPattern<PsiElement> pattern) {
if (sibling == null) return Collections.emptySet();

Expand All @@ -184,6 +186,7 @@ public static <T extends PsiElement> Collection<T> getNextSiblingOfTypes(@Nullab
}

@NotNull
@SuppressWarnings("unchecked")
public static <T extends PsiElement> Collection<T> getNextSiblingOfTypes(@Nullable PsiElement sibling, Class<T> pattern) {
if (sibling == null) return Collections.emptySet();

Expand All @@ -199,6 +202,7 @@ public static <T extends PsiElement> Collection<T> getNextSiblingOfTypes(@Nullab
}

@Nullable
@SuppressWarnings("unchecked")
public static <T extends PsiElement> T getPrevSiblingOfType(@Nullable PsiElement sibling, ElementPattern<T> pattern) {
if (sibling == null) return null;
for (PsiElement child = sibling.getPrevSibling(); child != null; child = child.getPrevSibling()) {
Expand All @@ -221,6 +225,7 @@ public static void getPrevSiblingOnCallback(@Nullable PsiElement sibling, Proces
}

@Nullable
@SuppressWarnings("unchecked")
public static <T extends PsiElement> T getChildrenOfType(@Nullable PsiElement element, ElementPattern<T> pattern) {
if (element == null) return null;

Expand All @@ -235,6 +240,7 @@ public static <T extends PsiElement> T getChildrenOfType(@Nullable PsiElement el
}

@NotNull
@SuppressWarnings("unchecked")
public static <T extends PsiElement> Collection<T> getChildrenOfTypeAsList(@Nullable PsiElement element, ElementPattern<T> pattern) {

Collection<T> collection = new ArrayList<>();
Expand Down Expand Up @@ -353,6 +359,7 @@ public static PsiElement getParentOfType(@Nullable PsiElement element, @NotNull
return null;
}

@SuppressWarnings("unchecked")
public static <T extends PsiElement> List<T> getPrevSiblingsOfType(@Nullable PsiElement sibling, ElementPattern<T> pattern) {

List<T> elements = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ public static boolean isNotNullAndIsElementType(@Nullable PsiElement psiElement,
}

@Nullable
@SuppressWarnings("unchecked")
public static <T extends PsiElement> T getParentOfTypeOrNull(@NotNull PsiElement element, @NotNull Class<T> aClass) {
PsiElement parent = element.getParent();
return aClass.isInstance(parent) ? (T) parent : null;
}

@Nullable
@SuppressWarnings("unchecked")
public static <T extends PsiNamedElement> T getParentOfTypeWithNameOrNull(@NotNull PsiElement element, @NotNull Class<T> aClass, @NotNull String name) {
PsiElement parent = element.getParent();
if(!aClass.isInstance(parent) || !(parent instanceof PsiNamedElement) || !name.equals(((PsiNamedElement) parent).getName())) {
Expand All @@ -34,6 +36,7 @@ public static <T extends PsiNamedElement> T getParentOfTypeWithNameOrNull(@NotNu
}

@Nullable
@SuppressWarnings("unchecked")
public static <T extends PsiElement> T getInstanceOfOrNull(@Nullable PsiElement element, @NotNull Class<T> aClass) {
if(element == null) return null;
return aClass.isInstance(element) ? (T) element : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private boolean isModified(Collection<File> serviceFiles) {
}

@Nullable
@SuppressWarnings("unchecked")
synchronized public <T extends ServiceParserInterface> T parser(Class<T> serviceParser) {
Collection<File> settingsServiceFiles = Symfony2ProjectComponent.getContainerFiles(this.project);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
public class YamlPsiElementFactory {
@Nullable
@SuppressWarnings("unchecked")
public static <T extends PsiElement> T createFromText(@NotNull Project p, final Class<T> aClass, String text) {
final PsiElement[] ret = new PsiElement[]{null};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public synchronized static RemoteFileStorageInterface[] getExtension(@NotNull Pr
}

@Nullable
@SuppressWarnings("unchecked")
public static <T> T getExtensionInstance(@Nullable Project project, @NotNull Class<T> aClass) {
if(!STORAGE_INSTANCES.containsKey(project)) {
return null;
Expand All @@ -59,6 +60,7 @@ public static <T> T getExtensionInstance(@Nullable Project project, @NotNull Cla
return null;
}

@SuppressWarnings("unchecked")
public static void collectRemoteFiles(final @NotNull Project project) {
WebServerConfig defaultServer = findDefaultServer(project);
if(defaultServer == null) {
Expand Down