@Override public void enableCosmetic(Player player, ParticleCosmetic cosmetic, ClickType clickType, boolean login, NullType useless) { try { Effect particleEffectObject = cosmetic.getParticleEffect().getConstructor(EffectManager.class).newInstance(this.effectManager); particleEffectObject.setEntity(player); particleEffectObject.infinite(); particleEffectObject.start(); this.playersParticleEffect.put(player.getUniqueId(), particleEffectObject); if (!login) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Vous voilà noyé sous les particules..."); } catch (ReflectiveOperationException e) { this.hub.getCosmeticManager().log(Level.SEVERE, "Can't create EntityEffect object to " + player.getName() + "'s particle effect!"); } }
private SrcType makeTypeVarType( Symbol.TypeVariableSymbol typeVar ) { StringBuilder sb = new StringBuilder( typeVar.type.toString() ); Type lowerBound = typeVar.type.getLowerBound(); if( lowerBound != null && !(lowerBound instanceof NullType) ) { sb.append( " super " ).append( lowerBound.toString() ); } else { Type upperBound = typeVar.type.getUpperBound(); if( upperBound != null && !(upperBound instanceof NoType) && !upperBound.toString().equals( Object.class.getName() ) ) { sb.append( " extends " ).append( upperBound.toString() ); } } return new SrcType( sb.toString() ); }
@Override public NullType visit(ASTNode.XmlParam node, NullType parent) { log.debug("checking %s", node); ExpressionNameCheck checker = new ExpressionNameCheck(node); assert node.xpathPattern != null; assert node.xpathEvaluationType != null; node.xpathPattern.accept(checker); return null; }
@Test public void testNull() throws SQLException{ ResultSet mockResultSet = createMockedResultSet("NULL", Types.NULL); variableUpdateRowMapper.map(mockResultSet); DynVar dynVar = rdbmsContext.getOutVar(); assertNotNull(dynVar); assertEquals(NullType.class, dynVar.getFirstClassFromKey(LABEL)); List values = dynVar.getValues(LABEL); assertNotNull(values); assertEquals(1, values.size()); Object value = values.get(0); assertNull(value); }
@Override public void enableCosmetic(Player player, BalloonCosmetic cosmetic, ClickType clickType, boolean login, NullType useless) { cosmetic.spawn(player); if (!login) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Des ballons flottent autour de vous !"); }
@Override public void disableCosmetic(Player player, BalloonCosmetic cosmetic, boolean logout, boolean replace, NullType useless) { cosmetic.remove(player); if (!logout && !replace) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Vos ballons ont éclatés."); }
@Override public void enableCosmetic(Player player, DisguiseCosmetic cosmetic, ClickType clickType, boolean login, NullType useless) { MobDisguise disguise = new MobDisguise(cosmetic.getDisguiseType()); disguise.setShowName(true); disguise.setViewSelfDisguise(false); DisguiseAPI.disguiseToAll(player, disguise); if (!login) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Vous êtes maintenant déguisé !"); }
@Override public void disableCosmetic(Player player, DisguiseCosmetic cosmetic, boolean logout, boolean replace, NullType useless) { if (DisguiseAPI.isDisguised(player)) DisguiseAPI.undisguiseToAll(player); if (!logout && !replace) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Votre déguisement disparait dans l'ombre..."); }
@Override public void enableCosmetic(Player player, ClothCosmetic cosmetic, ClickType clickType, boolean login, NullType useless) { if (this.getEquippedCosmetics(player) != null) this.getEquippedCosmetics(player).stream().filter(c -> cosmetic.getSlot() == c.getSlot()).forEach(c -> this.disableCosmetic(player, c, false, true)); cosmetic.getSlot().equip(player, cosmetic.getPiece()); if (!login) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Vous brillez de mille feux avec votre nouvel habit !"); }
@Override public void disableCosmetic(Player player, ClothCosmetic cosmetic, boolean logout, boolean replace, NullType useless) { if (this.previewers.containsKey(player.getUniqueId())) this.stopPreview(player); cosmetic.getSlot().equip(player, null); if (!logout && !replace) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Vous retirez votre vêtement..."); }
@Override public void enableCosmetic(Player player, PetCosmetic cosmetic, ClickType clickType, boolean login, NullType useless) { IPet pet = EchoPetAPI.getAPI().givePet(player, cosmetic.getPetType(), false); pet.setPetName(player.getName(), false); cosmetic.applyCustomization(pet); if (!login) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Votre animal vient de sortir de l'écurie !"); }
@Override public void disableCosmetic(Player player, PetCosmetic cosmetic, boolean logout, boolean replace, NullType useless) { if (EchoPetAPI.getAPI().hasPet(player)) { EchoPetAPI.getAPI().removePet(player, false, false); if (!logout && !replace) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Votre animal disparait dans l'ombre..."); } }
@Override public void disableCosmetic(Player player, ParticleCosmetic cosmetic, boolean logout, boolean replace, NullType useless) { if (this.playersParticleEffect.containsKey(player.getUniqueId())) { this.playersParticleEffect.get(player.getUniqueId()).cancel(); this.playersParticleEffect.remove(player.getUniqueId()); } if (!logout && !replace) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Votre effet disparait dans l'ombre..."); }
@Override public void enableCosmetic(Player player, GadgetCosmetic cosmetic, ClickType clickType, boolean login, NullType useless) { player.getInventory().setItem(6, cosmetic.getIcon(player)); if (!login) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Votre gadget a été équipé dans votre barre d'action."); }
@Override public void disableCosmetic(Player player, GadgetCosmetic cosmetic, boolean logout, boolean replace, NullType useless) { if (!logout) { player.getInventory().setItem(6, null); if (!replace) player.sendMessage(PlayerManager.COSMETICS_TAG + ChatColor.GREEN + "Votre gadget a été déséquipé."); } }
private void checkPrimitive(final Object primitive, ValidationResults results, String crumb) { if (!(primitive instanceof String || primitive instanceof Number || primitive instanceof Boolean)) { results.withCrumb(crumb, new Runnable() { @Override public void run() { Messages.m.msg("BadPrimitive|Invalid primitive value", String.valueOf(primitive), (primitive != null ? primitive.getClass() : NullType.class).getName()); } }); } }
/** * Returns a {@link NullType} if the {@link TypeMirror} represents the null type * or throws an {@link IllegalArgumentException}. */ public static NullType asNullType(TypeMirror maybeNullType) { return maybeNullType.accept(new CastingTypeVisitor<NullType>() { @Override public NullType visitNull(NullType nullType, String p) { return nullType; } }, "null"); }
@Test public void testToString() { // PrimitiveType for (TypeKind primitive: Arrays.asList(TypeKind.DOUBLE, TypeKind.FLOAT, TypeKind.LONG, TypeKind.INT, TypeKind.SHORT, TypeKind.BYTE, TypeKind.CHAR, TypeKind.BOOLEAN)) { PrimitiveType primitiveType = types.getPrimitiveType(primitive); Assert.assertEquals(types.getPrimitiveType(primitive).toString(), types.toString(primitiveType)); } // DeclaredType DeclaredType declaredType = (DeclaredType) types.typeMirror(Integer.class); Assert.assertEquals(declaredType.toString(), types.toString(declaredType)); // IntersectionType IntersectionType intersectionType = types.getIntersectionType(types.typeMirror(Serializable.class), types.typeMirror(Cloneable.class)); Assert.assertEquals(intersectionType.toString(), types.toString(intersectionType)); // WildcardType WildcardType wildcardType = types.getWildcardType(types.typeMirror(Integer.class), null); Assert.assertEquals(wildcardType.toString(), types.toString(wildcardType)); // NullType NullType nullType = types.getNullType(); Assert.assertEquals(nullType.toString(), types.toString(nullType)); // NoType NoType noType = types.getNoType(TypeKind.VOID); Assert.assertEquals(noType.toString(), types.toString(noType)); // TypeVariable TypeVariable typeVariable = (TypeVariable) types.typeElement(List.class).getTypeParameters().get(0).asType(); Assert.assertEquals(typeVariable.toString(), types.toString(typeVariable)); }
@Override public NullType visit(ASTNode.ExprParam node, NullType parent) { log.debug("checking %s", node); assert node.expr != null; node.expr.accept(new ExpressionNameCheck(node)); return null; }
@Override public NullType visit(ASTNode.BinaryParam node, NullType parent) { log.debug("checking %s", node); ExpressionNameCheck checker = new ExpressionNameCheck(node); assert node.format != null; assert node.offset != null; node.format.accept(checker); node.offset.accept(checker); return null; }
@Override public NullType visit(ASTNode.TextParam node, NullType parent) { log.debug("checking %s", node); ExpressionNameCheck checker = new ExpressionNameCheck(node); assert node.line != null; assert node.pattern != null; assert node.group != null; node.line.accept(checker); node.pattern.accept(checker); node.group.accept(checker); return null; }
@Override public NullType visit(ASTNode.CodecID node, NullType parent) { log.debug("checking %s", node); ExpressionNameCheck checker = new ExpressionNameCheck(node); assert node.provider != null; assert node.version != null; node.provider.accept(checker); node.version.accept(checker); return null; }
@Override public NullType visit(ASTNode.FormatID node, NullType parent) { log.debug("checking %s", node); ExpressionNameCheck checker = new ExpressionNameCheck(node); assert node.name != null; assert node.provider != null; assert node.version != null; node.name.accept(checker); node.provider.accept(checker); node.version.accept(checker); return null; }
@Override public NullType visit(ASTNode.Assert node, NullType parent) { log.debug("checking %s", node); assert node.expr != null; node.expr.accept(new ExpressionNameCheck(node)); return null; }
@Override public NullType visit(ASTNode.FileHandle<?> node, NullType parent) { log.debug("checking %s", node); if (node.filename != null) node.filename.accept(new ExpressionNameCheck(node)); return null; }
private void fixupBoundAnnotations() { if (!annotations.isEmpty() && upperBound != null) { // TODO: there seems to be some (for me) unexpected sharing // between upper bounds. Without the copying in the next line, test // case KeyForChecked fails, because the annotation on the return type // type variable changes the upper bound of the parameter type variable. // Should such a copy be made somewhere else and for more? upperBound = upperBound.getCopy(true); // TODO: this direct replacement forbids us to check well-formedness, // which is done in // org.checkerframework.common.basetype.BaseTypeVisitor.TypeValidator.visitTypeVariable(AnnotatedTypeVariable, Tree) // and assumed in nullness test Wellformed. // Which behavior do we want? upperBound.replaceAnnotations(annotations); } if (upperBound != null && upperBound.getAnnotations().isEmpty()) { // new Throwable().printStackTrace(); // upperBound.addAnnotations(typeFactory.qualHierarchy.getRootAnnotations()); // TODO: this should never happen. } if (((TypeVariable)actualType).getLowerBound() instanceof NullType && lowerBound != null && upperBound != null) { Set<AnnotationMirror> lAnnos = lowerBound.getEffectiveAnnotations(); Set<AnnotationMirror> uAnnos = upperBound.getEffectiveAnnotations(); QualifierHierarchy qualifierHierarchy = atypeFactory.getQualifierHierarchy(); for (AnnotationMirror top : qualifierHierarchy.getTopAnnotations()) { AnnotationMirror lAnno = qualifierHierarchy.getAnnotationInHierarchy(lAnnos, top); AnnotationMirror uAnno = qualifierHierarchy.getAnnotationInHierarchy(uAnnos, top); fixupBoundAnnotationsImpl(qualifierHierarchy, lowerBound, upperBound, annotations, top, lAnno, uAnno); } } }
@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { switch (kind) { case BOOLEAN: case BYTE: case SHORT: case INT: case LONG: case CHAR: case FLOAT: case DOUBLE: return v.visitPrimitive((PrimitiveType) this, p); case PACKAGE: case VOID: case NONE: return v.visitNoType((NoType) this, p); case NULL: return v.visitNull((NullType) this, p); case ARRAY: return v.visitArray((ArrayType) this, p); case DECLARED: return v.visitDeclared((DeclaredType) this, p); case ERROR: return v.visitError((ErrorType) this, p); case TYPEVAR: return v.visitTypeVariable((TypeVariable) this, p); case WILDCARD: return v.visitWildcard((WildcardType) this, p); case EXECUTABLE: return v.visitExecutable((ExecutableType) this, p); case OTHER: return v.visit(this, p); case UNION: return v.visitUnion((UnionType) this, p); case INTERSECTION: return v.visitIntersection((IntersectionType) this, p); default: throw new AssertionError(String.format("Unknown TypeKind: %s", kind)); } }
public static Highlighter getDefaultHighlighter(){ return new Highlighter(){ @Override public Function<Object, NullType> getHiglightFunction() { return highlightComponentFunction; } @Override public Function<Object, NullType> getUndoFunction() { return dehighlighComponentFunction; } }; }
@Override public NullType apply(@Nullable Object input) { input = resolveComponentFromSource(input); if(input instanceof JComponent){ JComponent comp = (JComponent) input; comp.setBorder(BorderFactory.createLineBorder(Color.white, 3)); } return null; }
@Override public Type visitNull(NullType t, Type.Parameters p) { throw new UnsupportedOperationException("NullType type not supported"); }