Skip to content

Commit

Permalink
Merge pull request #1107 from Liyw979/feature/has-annoation
Browse files Browse the repository at this point in the history
add HasAnnotation for JavaSootClass, JavaSootField and JavaSootMethod
  • Loading branch information
swissiety authored Oct 22, 2024
2 parents 07598f6 + 06b7202 commit 57a57a5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
32 changes: 32 additions & 0 deletions sootup.java.core/src/main/java/sootup/java/core/HasAnnotation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package sootup.java.core;

/*-
* #%L
* SootUp
* %%
* Copyright (C) 1997 - 2024 Raja Vallée-Rai and others
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/

/**
* Interface to mark Soot code objects that may contain annotations.
*
* @author liyiwei
*/
public interface HasAnnotation {
Iterable<AnnotationUsage> getAnnotations();
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import sootup.core.types.Type;
import sootup.java.core.types.JavaClassType;

public class JavaSootClass extends SootClass {
public class JavaSootClass extends SootClass implements HasAnnotation {

public JavaSootClass(JavaSootClassSource classSource, SourceType sourceType) {
super(classSource, sourceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import sootup.core.model.SootField;
import sootup.core.signatures.FieldSignature;

public class JavaSootField extends SootField {
public class JavaSootField extends SootField implements HasAnnotation {

@Nonnull private final Iterable<AnnotationUsage> annotations;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import sootup.core.signatures.MethodSignature;
import sootup.core.types.ClassType;

public class JavaSootMethod extends SootMethod {
public class JavaSootMethod extends SootMethod implements HasAnnotation {
@Nonnull private final Iterable<AnnotationUsage> annotations;

public JavaSootMethod(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
import sootup.core.jimple.basic.Local;
import sootup.core.types.Type;
import sootup.java.core.AnnotationUsage;
import sootup.java.core.HasAnnotation;

public class JavaLocal extends Local {
public class JavaLocal extends Local implements HasAnnotation {

// TODO: [ms] add to JavaJimple
// TODO: [ms] make use of this class in both Java Frontends
Expand Down

0 comments on commit 57a57a5

Please sign in to comment.