|
84 | 84 | import soot.Trap;
|
85 | 85 | import soot.Type;
|
86 | 86 | import soot.Unit;
|
| 87 | +import soot.dexpler.DexType; |
87 | 88 | import soot.dexpler.Util;
|
88 | 89 | import soot.jimple.Jimple;
|
89 | 90 | import soot.jimple.NopStmt;
|
@@ -549,6 +550,7 @@ else if (c.hasOuterClass()) {
|
549 | 550 | if (memberClassesItem != null)
|
550 | 551 | annotations.addAll(memberClassesItem);
|
551 | 552 | }
|
| 553 | + |
552 | 554 |
|
553 | 555 | for (Tag t : c.getTags()) {
|
554 | 556 | if (t.getName().equals("VisibilityAnnotationTag")){
|
@@ -585,7 +587,7 @@ else if (c.hasOuterClass()) {
|
585 | 587 | (defaultAnnotationTag, skipList);
|
586 | 588 | annotations.addAll(visibilityItems);
|
587 | 589 | }
|
588 |
| - |
| 590 | + |
589 | 591 | return annotations;
|
590 | 592 | }
|
591 | 593 |
|
@@ -615,6 +617,26 @@ private Set<Annotation> buildMethodAnnotations(SootMethod m) {
|
615 | 617 | annotations.addAll(visibilityItems);
|
616 | 618 | }
|
617 | 619 | }
|
| 620 | + List<SootClass> exceptionList = m.getExceptions(); |
| 621 | + if (exceptionList != null) { |
| 622 | + Set<ImmutableAnnotationElement> elements = new HashSet<ImmutableAnnotationElement>(); |
| 623 | + List<ImmutableEncodedValue> valueList = new ArrayList<ImmutableEncodedValue>(); |
| 624 | + for (SootClass exceptionClass : exceptionList) { |
| 625 | + |
| 626 | + valueList.add(new ImmutableTypeEncodedValue(DexType.toDalvikICAT(exceptionClass.getName()).replace(".", "/"))); |
| 627 | + |
| 628 | + } |
| 629 | + ImmutableArrayEncodedValue valueValue = new ImmutableArrayEncodedValue(valueList); |
| 630 | + ImmutableAnnotationElement valueElement = new ImmutableAnnotationElement |
| 631 | + ("value", valueValue); |
| 632 | + elements.add(valueElement); |
| 633 | + ImmutableAnnotation ann = new ImmutableAnnotation |
| 634 | + (AnnotationVisibility.SYSTEM, |
| 635 | + "Ldalvik/annotation/Throws;", |
| 636 | + elements); |
| 637 | + annotations.add(ann); |
| 638 | + } |
| 639 | + |
618 | 640 |
|
619 | 641 | return annotations;
|
620 | 642 | }
|
@@ -677,7 +699,7 @@ private Set<Annotation> buildCommonAnnotations(AbstractHost host, Set<String> sk
|
677 | 699 | elements);
|
678 | 700 | annotations.add(ann);
|
679 | 701 | skipList.add("Ldalvik/annotation/Signature;");
|
680 |
| - } |
| 702 | + } |
681 | 703 |
|
682 | 704 | return annotations;
|
683 | 705 | }
|
|
0 commit comments