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

not throw exceptions when class of annotation not found #726

Merged
merged 7 commits into from
Nov 20, 2023
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 @@ -68,10 +68,7 @@ public boolean isStaticInitializer() {

@Nonnull
public Iterable<AnnotationUsage> getAnnotations(@Nonnull Optional<JavaView> view) {
annotations.forEach(e -> e.getAnnotation().getDefaultValues(view));
JonasKlauke marked this conversation as resolved.
Show resolved Hide resolved

resolveDefaultsForAnnotationTypes(view, annotations);

return annotations;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@
* #L%
*/

import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.*;
import java.util.stream.StreamSupport;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sootup.core.IdentifierFactory;
import sootup.core.model.SootMethod;
import sootup.core.signatures.PackageName;
Expand All @@ -48,6 +44,8 @@
*/
public class AnnotationType extends JavaClassType {

private static final Logger log = LoggerFactory.getLogger(AnnotationType.class);

public void setInherited(boolean inherited) {
isInherited = inherited;
}
Expand All @@ -70,12 +68,9 @@ public Map<String, Object> getDefaultValues(@Nonnull Optional<JavaView> viewOpti
JavaView jv = viewOptional.get();

// meta annotations are not in the view
if (this.isMetaAnnotation()) {
return defaultValues;
}

if (!jv.getClass(this).isPresent()) {
throw new RuntimeException("Class of annotation not in view");
Liyw979 marked this conversation as resolved.
Show resolved Hide resolved
log.error("Class of annotation " + this + "is not in current view.");
return defaultValues;
}

JavaSootClass jsc = jv.getClass(this).get();
Expand Down