@Override public boolean visitMethodInvocation(MethodInvocation node) { if (SET_SMALL_ICON.equals(node.astName().astValue())) { StrictListAccessor<Expression,MethodInvocation> arguments = node.astArguments(); if (arguments.size() == 1 && arguments.first() instanceof Select) { handleSelect((Select) arguments.first()); } } return super.visitMethodInvocation(node); } }
@Override public P migrateAllFrom(StrictListAccessor<? extends T, ?> otherList) { while (!otherList.isEmpty()) { AbstractNode n = (AbstractNode) otherList.first(); otherList.remove(n); raw.addToEnd(n); } return returnAsParent; }
@Override public P migrateAllFrom(StrictListAccessor<? extends T, ?> otherList) { while (!otherList.isEmpty()) { AbstractNode n = (AbstractNode) otherList.first(); otherList.remove(n); raw.addToEnd(n); } return returnAsParent; }
@Override public P migrateAllFrom(StrictListAccessor<? extends T, ?> otherList) { while (!otherList.isEmpty()) { AbstractNode n = (AbstractNode) otherList.first(); otherList.remove(n); raw.addToEnd(n); } return returnAsParent; }
@CopyMethod static boolean isPrimitive(TypeReference self) { if (self.astArrayDimensions() > 0 || self.rawParts().size() != 1) return false; try { String name = self.astParts().first().astIdentifier().astValue(); return name.indexOf(' ') == -1 && PRIMITIVE_NAMES.contains(" " + name + " "); } catch (NullPointerException e) { return false; } }
public void checkSwitchStartsWithDefaultOrCase(Switch node) { Block body = node.astBody(); if (body != null) { Statement first = body.astContents().first(); if (first != null && !(first instanceof Case) && !(first instanceof Default)) { node.addMessage(error(SWITCH_DOES_NOT_START_WITH_CASE, "switch statements should start with a default or case statement.")); } } } }
@CopyMethod static boolean isPrimitive(TypeReference self) { if (self.astArrayDimensions() > 0 || self.rawParts().size() != 1) return false; try { String name = self.astParts().first().astIdentifier().astValue(); return name.indexOf(' ') == -1 && PRIMITIVE_NAMES.contains(" " + name + " "); } catch (NullPointerException e) { return false; } }
public void checkSwitchStartsWithDefaultOrCase(Switch node) { Block body = node.astBody(); if (body != null) { Statement first = body.astContents().first(); if (first != null && !(first instanceof Case) && !(first instanceof Default)) { node.addMessage(error(SWITCH_DOES_NOT_START_WITH_CASE, "switch statements should start with a default or case statement.")); } } } }
public void checkSwitchStartsWithDefaultOrCase(Switch node) { Block body = node.astBody(); if (body != null) { Statement first = body.astContents().first(); if (first != null && !(first instanceof Case) && !(first instanceof Default)) { node.addMessage(error(SWITCH_DOES_NOT_START_WITH_CASE, "switch statements should start with a default or case statement.")); } } } }
@CopyMethod static boolean isPrimitive(TypeReference self) { if (self.astArrayDimensions() > 0 || self.rawParts().size() != 1) return false; try { String name = self.astParts().first().astIdentifier().astValue(); return name.indexOf(' ') == -1 && PRIMITIVE_NAMES.contains(" " + name + " "); } catch (NullPointerException e) { return false; } }
@CopyMethod static boolean isVoid(TypeReference self) { if (self.rawParts().size() != 1) return false; try { String name = self.astParts().first().astIdentifier().astValue(); return name.equals("void"); } catch (NullPointerException e) { return false; } }
@CopyMethod static boolean isVoid(TypeReference self) { if (self.rawParts().size() != 1) return false; try { String name = self.astParts().first().astIdentifier().astValue(); return name.equals("void"); } catch (NullPointerException e) { return false; } }
private static boolean isPrimitive(TypeReference ref, String primitiveName) { if (ref.astArrayDimensions() > 0 || ref.rawParts().size() != 1) return false; try { String name = ref.astParts().first().astIdentifier().astValue(); return name.equals(primitiveName); } catch (NullPointerException e) { return false; } }
private static boolean isPrimitive(TypeReference ref, String primitiveName) { if (ref.astArrayDimensions() > 0 || ref.rawParts().size() != 1) return false; try { String name = ref.astParts().first().astIdentifier().astValue(); return name.equals(primitiveName); } catch (NullPointerException e) { return false; } }
private static boolean isPrimitive(TypeReference ref, String primitiveName) { if (ref.astArrayDimensions() > 0 || ref.rawParts().size() != 1) return false; try { String name = ref.astParts().first().astIdentifier().astValue(); return name.equals(primitiveName); } catch (NullPointerException e) { return false; } }
@CopyMethod static boolean isVoid(TypeReference self) { if (self.rawParts().size() != 1) return false; try { String name = self.astParts().first().astIdentifier().astValue(); return name.equals("void"); } catch (NullPointerException e) { return false; } }
@Override public void visitMethod(@NonNull JavaContext context, @Nullable AstVisitor visitor, @NonNull MethodInvocation node) { if (node.astArguments().size() == 1 && !node.astArguments().first().toString().equals("false")) { //$NON-NLS-1$ context.report(ISSUE, node, context.getLocation(node), "Using `setJavaScriptEnabled` can introduce XSS vulnerabilities " + "into you application, review carefully."); } }
private void constructorInvocationMustBeFirst(Statement node, String desc) { if (node.getParent() == null) return; Block b = node.upToBlock(); if (b == null || b.upToConstructorDeclaration() == null || b.astContents().first() != node) { node.addMessage(error(CONSTRUCTOR_INVOCATION_NOT_LEGAL_HERE, "Calling " + desc + " must be the first statement in a constructor.")); return; } }
private void constructorInvocationMustBeFirst(Statement node, String desc) { if (node.getParent() == null) return; Block b = node.upToBlock(); if (b == null || b.upToConstructorDeclaration() == null || b.astContents().first() != node) { node.addMessage(error(CONSTRUCTOR_INVOCATION_NOT_LEGAL_HERE, "Calling " + desc + " must be the first statement in a constructor.")); return; } }
private void constructorInvocationMustBeFirst(Statement node, String desc) { if (node.getParent() == null) return; Block b = node.upToBlock(); if (b == null || b.upToConstructorDeclaration() == null || b.astContents().first() != node) { node.addMessage(error(CONSTRUCTOR_INVOCATION_NOT_LEGAL_HERE, "Calling " + desc + " must be the first statement in a constructor.")); return; } }