/** * {@inheritDoc} */ public PackageDescription getPackage() { return delegate.getPackage(); }
/** * {@inheritDoc} */ public PackageDescription getPackage() { return typeDescription.getPackage(); }
/** * {@inheritDoc} */ public PackageDescription getPackage() { return delegate().getPackage(); }
/** * {@inheritDoc} */ public boolean isSamePackage(TypeDescription typeDescription) { PackageDescription thisPackage = getPackage(), otherPackage = typeDescription.getPackage(); return thisPackage == null || otherPackage == null ? thisPackage == otherPackage : thisPackage.equals(otherPackage); }
/** * {@inheritDoc} */ public boolean contains(TypeDescription typeDescription) { return this.equals(typeDescription.getPackage()); }
/** * {@inheritDoc} */ public Map<String, Class<?>> injectRaw(Map<? extends String, byte[]> types) { String expectedPackage = TypeDescription.ForLoadedType.of(lookupType()).getPackage().getName(); Map<String, Class<?>> result = new HashMap<String, Class<?>>(); for (Map.Entry<? extends String, byte[]> entry : types.entrySet()) { int index = entry.getKey().lastIndexOf('.'); if (!expectedPackage.equals(index == -1 ? "" : entry.getKey().substring(0, index))) { throw new IllegalArgumentException(entry.getKey() + " must be defined in the same package as " + lookup); } result.put(entry.getKey(), DISPATCHER.defineClass(lookup, entry.getValue())); } return result; }
output.append('L').append(nullable.getMarker()); PackageDescription pakkage = type.asErasure().getPackage();
/** * @see me.seeber.gradle.ide.eclipse.annotations.Nullability#getParameterNullability(net.bytebuddy.description.method.ParameterDescription) */ @Override public Nullness getParameterNullability(ParameterDescription parameter) { PackageDescription pakkage = parameter.getDeclaringMethod().getDeclaringType().asErasure().getPackage(); Optional<AnnotationDescription> packageAnnotation = pakkage.getDeclaredAnnotations().stream() .filter(a -> a.getAnnotationType().getName().equals(this.nonnullParameterDefaultAnnotation)).findAny(); Nullness defaultNullness = Validate .notNull(packageAnnotation.map(a -> Nullness.NONNULL).orElse(Nullness.UNDEFINED)); Nullness nullability = getNullability(parameter.getDeclaredAnnotations()); return defaultNullness.override(nullability); }
output.append('L').append(nullable.getMarker()); PackageDescription pakkage = type.asErasure().getPackage();
/** * @see me.seeber.gradle.ide.eclipse.annotations.Nullability#getParameterNullability(net.bytebuddy.description.method.ParameterDescription) */ @Override public Nullness getParameterNullability(ParameterDescription parameter) { PackageDescription pakkage = parameter.getDeclaringMethod().getDeclaringType().asErasure().getPackage(); Optional<AnnotationDescription> packageAnnotation = pakkage.getDeclaredAnnotations().stream() .filter(a -> a.getAnnotationType().getName().equals(this.nonnullParameterDefaultAnnotation)).findAny(); Nullness defaultNullness = Validate .notNull(packageAnnotation.map(a -> Nullness.NONNULL).orElse(Nullness.UNDEFINED)); Nullness nullability = getNullability(parameter.getDeclaredAnnotations()); return defaultNullness.override(nullability); }
@Test void testIncludedPackages() { final TypeDescription thisClass = TypeDescription.ForLoadedType.of(getClass()); assertThat(isInAnyPackage(List.of(), none()).matches(thisClass)).isFalse(); assertThat(isInAnyPackage(List.of(thisClass.getPackage().getName()), none()).matches(thisClass)).isTrue(); assertThat(isInAnyPackage(List.of(thisClass.getPackage().getName()), none()).matches(TypeDescription.ForLoadedType.of(Object.class))).isFalse(); }