From 7f6f48d6b569d4c97e21c30a7094577231878b36 Mon Sep 17 00:00:00 2001 From: yeom Date: Wed, 13 Jul 2011 20:23:16 +0000 Subject: [PATCH] fix: does not need to check a class that does not have any annotated method --- Robust/src/Analysis/SSJava/FlowDownCheck.java | 4 ++-- Robust/src/Analysis/SSJava/SSJavaAnalysis.java | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Robust/src/Analysis/SSJava/FlowDownCheck.java b/Robust/src/Analysis/SSJava/FlowDownCheck.java index e752141d..3d892067 100644 --- a/Robust/src/Analysis/SSJava/FlowDownCheck.java +++ b/Robust/src/Analysis/SSJava/FlowDownCheck.java @@ -103,8 +103,8 @@ public class FlowDownCheck { ClassDescriptor cd = (ClassDescriptor) obj; toanalyze.remove(cd); - if (!cd.isInterface()) { - + if (ssjava.needToBeAnnoated(cd) && (!cd.isInterface())) { + ClassDescriptor superDesc = cd.getSuperDesc(); if (superDesc != null && (!superDesc.isInterface()) && (!superDesc.getSymbol().equals("Object"))) { diff --git a/Robust/src/Analysis/SSJava/SSJavaAnalysis.java b/Robust/src/Analysis/SSJava/SSJavaAnalysis.java index 7e804075..21ae3920 100644 --- a/Robust/src/Analysis/SSJava/SSJavaAnalysis.java +++ b/Robust/src/Analysis/SSJava/SSJavaAnalysis.java @@ -37,7 +37,7 @@ public class SSJavaAnalysis { FlowDownCheck flowDownChecker; MethodAnnotationCheck methodAnnotationChecker; - // if a method has annotations, the mapping has true + // set containing method requires to be annoated Set annotationRequireSet; // class -> field lattice @@ -49,12 +49,15 @@ public class SSJavaAnalysis { // method -> local variable lattice Hashtable> md2lattice; - // method set that does not have loop termination analysis + // method set that does not want to have loop termination analysis Hashtable skipLoopTerminate; // map shared location to its descriptors Hashtable> mapSharedLocation2DescriptorSet; + // set containing a class that has at least one annoated method + Set annotationRequireClassSet; + CallGraph callgraph; public SSJavaAnalysis(State state, TypeUtil tu, CallGraph callgraph) { @@ -65,6 +68,7 @@ public class SSJavaAnalysis { this.cd2methodDefault = new Hashtable>(); this.md2lattice = new Hashtable>(); this.annotationRequireSet = new HashSet(); + this.annotationRequireClassSet = new HashSet(); this.skipLoopTerminate = new Hashtable(); this.mapSharedLocation2DescriptorSet = new Hashtable>(); } @@ -277,7 +281,15 @@ public class SSJavaAnalysis { return annotationRequireSet.contains(md); } + public boolean needToBeAnnoated(ClassDescriptor cd) { + return annotationRequireClassSet.contains(cd); + } + public void addAnnotationRequire(MethodDescriptor md) { + + // if a method requires to be annotated, class containg that method also + // requires to be annotated + annotationRequireClassSet.add(md.getClassDesc()); annotationRequireSet.add(md); } -- 2.34.1