Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove API that was deprecated in v0.12.0 #329

Merged
merged 2 commits into from
Apr 8, 2020
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 @@ -22,7 +22,6 @@
import com.tngtech.archunit.lang.ConditionEvents;
import com.tngtech.archunit.lang.SimpleConditionEvent;
import com.tngtech.archunit.lang.syntax.ArchRuleDefinition;
import com.tngtech.archunit.lang.syntax.ClassesIdentityTransformer;

import static com.tngtech.archunit.ArchUnitArchitectureTest.THIRDPARTY_PACKAGE_IDENTIFIER;
import static com.tngtech.archunit.PublicAPI.Usage.INHERITANCE;
Expand Down Expand Up @@ -95,8 +94,6 @@ public class PublicAPIRules {
classes()
.that().resideInAPackage("..syntax..")
.and().haveNameNotMatching(".*" + ArchRuleDefinition.class.getSimpleName() + ".*")
// FIXME: Remove this line once we throw the deprecated class out of the public API
.and().doNotHaveFullyQualifiedName(ClassesIdentityTransformer.class.getName())
.and().areNotInterfaces()
.and().areNotAnnotatedWith(Internal.class)
.should().notBePublic()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,6 @@ public static <T> DescribedPredicate<T> describe(String description, Predicate<?
return new DescribePredicate<>(description, predicate).forSubType();
}

/**
* @deprecated Decided to consistently never use contractions -&gt; use {@link #doesNot(DescribedPredicate)}
*/
@Deprecated
public static <T> DescribedPredicate<T> doesnt(final DescribedPredicate<? super T> predicate) {
return not(predicate).as("doesn't %s", predicate.getDescription()).forSubType();
}

/**
* @deprecated Decided to consistently never use contractions -&gt; use {@link #doNot(DescribedPredicate)}
*/
@Deprecated
public static <T> DescribedPredicate<T> dont(final DescribedPredicate<? super T> predicate) {
return not(predicate).as("don't %s", predicate.getDescription()).forSubType();
}

public static <T> DescribedPredicate<T> doesNot(final DescribedPredicate<? super T> predicate) {
return not(predicate).as("does not %s", predicate.getDescription()).forSubType();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,6 @@ public static final class FieldAccessTarget extends AccessTarget implements HasT
this.field = Suppliers.memoize(builder.getField());
}

/**
* @deprecated Use {@link #getRawType()} instead
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClass getType() {
return getRawType();
}

@Override
@PublicAPI(usage = ACCESS)
public JavaClass getRawType() {
Expand Down Expand Up @@ -322,32 +312,12 @@ public abstract static class CodeUnitCallTarget extends AccessTarget
this.returnType = builder.getReturnType();
}

/**
* @deprecated Use {@link #getRawParameterTypes()} instead
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClassList getParameters() {
return getRawParameterTypes();
}

@Override
@PublicAPI(usage = ACCESS)
public JavaClassList getRawParameterTypes() {
return DomainObjectCreationContext.createJavaClassList(parameters);
}

/**
* @deprecated Use {@link #getRawReturnType()} instead.
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClass getReturnType() {
return getRawReturnType();
}

@Override
@PublicAPI(usage = ACCESS)
public JavaClass getRawReturnType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,4 @@ public static String ensureSimpleName(String name) {
return "";
}

/**
* @param clazz Class determining the location
* @param lineNumber Line number of the location
* @return Arguments formatted as "(${clazz.getSimpleName()}.java:${lineNumber})". This format is (at least
* by IntelliJ Idea) recognized as location, if it's the end of a failure line, thus enabling IDE support
* to jump to a violation.
* @deprecated use {@link SourceCodeLocation}
* @see SourceCodeLocation
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static String formatLocation(JavaClass clazz, int lineNumber) {
return SourceCodeLocation.of(clazz, lineNumber).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ private String startWithLowerCase(HasDescription annotatedElement) {
return annotatedElement.getDescription().substring(0, 1).toLowerCase() + annotatedElement.getDescription().substring(1);
}

/**
* @deprecated Use {@link #getRawType()} instead
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClass getType() {
return getRawType();
}

@Override
@PublicAPI(usage = ACCESS)
public JavaClass getRawType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@ public String getFullName() {
return fullName;
}

/**
* @deprecated Use {@link #getRawParameterTypes()} instead
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClassList getParameters() {
return getRawParameterTypes();
}

@Override
@PublicAPI(usage = ACCESS)
public JavaClassList getRawParameterTypes() {
Expand All @@ -100,16 +90,6 @@ public JavaClassList getExceptionTypes() {
return getThrowsClause().getTypes();
}

/**
* @deprecated Use {@link #getRawReturnType()} instead.
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClass getReturnType() {
return getRawReturnType();
}

@Override
@PublicAPI(usage = ACCESS)
public JavaClass getRawReturnType() {
Expand Down Expand Up @@ -203,23 +183,11 @@ public boolean apply(JavaCodeUnit input) {
}
}

@PublicAPI(usage = ACCESS)
public static final class Functions {
private Functions() {
}

/**
* @deprecated Use {@link HasReturnType.Functions#GET_RAW_RETURN_TYPE} instead
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static final ChainableFunction<JavaCodeUnit, JavaClass> GET_RETURN_TYPE =
new ChainableFunction<JavaCodeUnit, JavaClass>() {
@Override
public JavaClass apply(JavaCodeUnit input) {
return input.getRawReturnType();
}
};

public static final class Get {
private Get() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ public String getFullName() {
return getOwner().getName() + "." + getName();
}

/**
* @deprecated Use {@link #getRawType()} instead
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClass getType() {
return getRawType();
}

@Override
@PublicAPI(usage = ACCESS)
public JavaClass getRawType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,6 @@ public JavaClass getDeclaringClass() {
return getLocation().getOwner();
}

/**
* @deprecated Use {@link #getRawType()} instead
*/
@Override
@Deprecated
@PublicAPI(usage = ACCESS)
public JavaClass getType() {
return getRawType();
}

/**
* @return The type of this {@link ThrowsDeclaration}, e.g. for a method
* <pre><code>void method() throws SomeException {...}</code></pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
import static com.tngtech.archunit.core.domain.JavaClassList.GET_NAMES;

public interface HasParameterTypes {
/**
* @deprecated Use {@link #getRawParameterTypes()} instead
*/
@Deprecated
@PublicAPI(usage = ACCESS)
JavaClassList getParameters();

@PublicAPI(usage = ACCESS)
JavaClassList getRawParameterTypes();
Expand All @@ -44,67 +38,27 @@ final class Predicates {
private Predicates() {
}

/**
* @deprecated Use {@link #rawParameterTypes(Class[])}
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> parameterTypes(final Class<?>... types) {
return adjustDeprecatedDescription(rawParameterTypes(types));
}

@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> rawParameterTypes(final Class<?>... types) {
return rawParameterTypes(namesOf(types));
}

/**
* @deprecated Use {@link #rawParameterTypes(String[])}
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> parameterTypes(final String... types) {
return adjustDeprecatedDescription(rawParameterTypes(types));
}

@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> rawParameterTypes(final String... types) {
return rawParameterTypes(ImmutableList.copyOf(types));
}

/**
* @deprecated Use {@link #rawParameterTypes(List)}
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> parameterTypes(final List<String> typeNames) {
return adjustDeprecatedDescription(rawParameterTypes(typeNames));
}

@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> rawParameterTypes(final List<String> typeNames) {
return new RawParameterTypesPredicate(equalTo(typeNames).onResultOf(GET_NAMES)
.as("[%s]", formatMethodParameterTypeNames(typeNames)));
}

/**
* @deprecated Use {@link #rawParameterTypes(DescribedPredicate)}
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> parameterTypes(final DescribedPredicate<? super JavaClassList> predicate) {
return adjustDeprecatedDescription(new RawParameterTypesPredicate(predicate));
}

@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasParameterTypes> rawParameterTypes(final DescribedPredicate<? super List<JavaClass>> predicate) {
return new RawParameterTypesPredicate(predicate);
}

private static DescribedPredicate<HasParameterTypes> adjustDeprecatedDescription(DescribedPredicate<HasParameterTypes> predicate) {
return predicate.as(predicate.getDescription().replace("raw parameter", "parameter"));
}

private static class RawParameterTypesPredicate extends DescribedPredicate<HasParameterTypes> {
private final DescribedPredicate<? super JavaClassList> predicate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
import static com.tngtech.archunit.core.domain.properties.HasReturnType.Functions.GET_RAW_RETURN_TYPE;

public interface HasReturnType {
/**
* @deprecated Use {@link #getRawReturnType()} instead.
*/
@Deprecated
@PublicAPI(usage = ACCESS)
JavaClass getReturnType();

@PublicAPI(usage = ACCESS)
JavaClass getRawReturnType();
Expand All @@ -39,51 +33,21 @@ final class Predicates {
private Predicates() {
}

/**
* @deprecated Use {@link #rawReturnType(Class)} instead.
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasReturnType> returnType(Class<?> returnType) {
return adjustDeprecatedDescription(rawReturnType(returnType));
}

@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasReturnType> rawReturnType(Class<?> returnType) {
return rawReturnType(returnType.getName());
}

/**
* @deprecated Use {@link #rawReturnType(String)} instead.
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasReturnType> returnType(String returnTypeName) {
return adjustDeprecatedDescription(rawReturnType(returnTypeName));
}

@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasReturnType> rawReturnType(String returnTypeName) {
return rawReturnType(name(returnTypeName).as(returnTypeName));
}

/**
* @deprecated Use {@link #rawReturnType(DescribedPredicate)} instead.
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasReturnType> returnType(DescribedPredicate<? super JavaClass> predicate) {
return adjustDeprecatedDescription(rawReturnType(predicate));
}

@PublicAPI(usage = ACCESS)
public static DescribedPredicate<HasReturnType> rawReturnType(DescribedPredicate<? super JavaClass> predicate) {
return predicate.onResultOf(GET_RAW_RETURN_TYPE).as("raw return type %s", predicate.getDescription());
}

private static DescribedPredicate<HasReturnType> adjustDeprecatedDescription(DescribedPredicate<HasReturnType> predicate) {
return predicate.as(predicate.getDescription().replace("raw return type", "return type"));
}
}

final class Functions {
Expand All @@ -98,11 +62,5 @@ public JavaClass apply(HasReturnType input) {
}
};

/**
* @deprecated Use {@link #GET_RAW_RETURN_TYPE} instead.
*/
@Deprecated
@PublicAPI(usage = ACCESS)
public static final ChainableFunction<HasReturnType, JavaClass> GET_RETURN_TYPE = GET_RAW_RETURN_TYPE;
}
}
Loading