├── .editorconfig ├── .gitattributes ├── .gitignore ├── .gitmodules ├── COPYING ├── COPYING.LESSER ├── README.md ├── build.gradle.kts ├── buildSrc ├── build.gradle.kts └── src │ └── main │ └── kotlin │ ├── CheckstyleUtils.kt │ ├── ProjectExtensions.kt │ ├── maven-publish.conventions.gradle.kts │ └── tai-e.conventions.gradle.kts ├── config ├── checkstyle │ ├── checkstyle.xml │ ├── import-control.xml │ └── java.header └── javadoc │ ├── footer.html │ ├── header.html │ ├── javadoc.css │ └── overview.html ├── docs ├── README.adoc ├── build.gradle.kts ├── coding-conventions.adoc ├── common │ ├── css │ │ └── custom.css │ └── img │ │ ├── pointer-analysis-framework-1.png │ │ ├── setup-in-intellij-idea-1.png │ │ ├── setup-in-intellij-idea-2.png │ │ ├── setup-in-intellij-idea-3.png │ │ ├── setup-in-intellij-idea-4.png │ │ ├── setup-in-intellij-idea-5.png │ │ ├── setup-in-intellij-idea-6.png │ │ ├── setup-in-intellij-idea-7.png │ │ └── setup-in-intellij-idea-8.png └── en │ ├── analysis-management.adoc │ ├── attributes.adoc │ ├── command-line-options.adoc │ ├── develop-new-analysis.adoc │ ├── docinfo.html │ ├── index-single.adoc │ ├── index.adoc │ ├── pointer-analysis-framework.adoc │ ├── program-abstraction.adoc │ ├── publications.adoc │ ├── setup-in-intellij-idea.adoc │ └── taint-analysis.adoc ├── gateway_entry_scan ├── config │ ├── __init__.py │ └── llm.py ├── input │ └── example-project.yaml ├── main.py ├── model │ ├── __init__.py │ └── model.py ├── prompt │ ├── example.py │ └── system.py └── requirements.txt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib └── sootclasses-modified.jar ├── settings.gradle.kts └── src ├── main ├── java │ ├── Starter.java │ ├── fdu │ │ └── secsys │ │ │ └── microservice │ │ │ ├── GatewayParser.java │ │ │ ├── entity │ │ │ ├── Endpoint.java │ │ │ └── Service.java │ │ │ ├── enums │ │ │ └── QueryType.java │ │ │ ├── plugin │ │ │ ├── DubboPlugin.java │ │ │ ├── GatewaySourcePlugin.java │ │ │ ├── GrpcPlugin.java │ │ │ ├── KafkaPlugin.java │ │ │ ├── MiscPlugin.java │ │ │ ├── MybatisXmlPlugin.java │ │ │ ├── OpenFeignPlugin.java │ │ │ ├── RabbitMQPlugin.java │ │ │ ├── RestTemplatePlugin.java │ │ │ └── gateway │ │ │ │ └── EndpointHandler.java │ │ │ └── util │ │ │ ├── ChainUtil.java │ │ │ ├── DubboUtil.java │ │ │ ├── FeignUtil.java │ │ │ ├── GatewayUtil.java │ │ │ ├── JarUtil.java │ │ │ ├── KafkaUtil.java │ │ │ ├── RabbitMQUtil.java │ │ │ ├── ServiceUtil.java │ │ │ └── YamlUtil.java │ └── pascal │ │ └── taie │ │ ├── AbstractWorldBuilder.java │ │ ├── Main.java │ │ ├── World.java │ │ ├── WorldBuilder.java │ │ ├── analysis │ │ ├── Analysis.java │ │ ├── AnalysisManager.java │ │ ├── ClassAnalysis.java │ │ ├── MethodAnalysis.java │ │ ├── ProgramAnalysis.java │ │ ├── StmtResult.java │ │ ├── bugfinder │ │ │ ├── BugInstance.java │ │ │ ├── BugType.java │ │ │ ├── CloneIdiom.java │ │ │ ├── DroppedException.java │ │ │ ├── Severity.java │ │ │ └── nullpointer │ │ │ │ ├── IsNullAnalysis.java │ │ │ │ ├── IsNullConditionDecision.java │ │ │ │ ├── IsNullFact.java │ │ │ │ ├── IsNullValue.java │ │ │ │ ├── NPEVarVisitor.java │ │ │ │ └── NullPointerDetection.java │ │ ├── dataflow │ │ │ ├── analysis │ │ │ │ ├── AbstractDataflowAnalysis.java │ │ │ │ ├── AnalysisDriver.java │ │ │ │ ├── DataflowAnalysis.java │ │ │ │ ├── LiveVariable.java │ │ │ │ ├── ReachingDefinition.java │ │ │ │ ├── availexp │ │ │ │ │ ├── AvailableExpression.java │ │ │ │ │ └── ExpWrapper.java │ │ │ │ └── constprop │ │ │ │ │ ├── CPFact.java │ │ │ │ │ ├── ConstantPropagation.java │ │ │ │ │ ├── Evaluator.java │ │ │ │ │ └── Value.java │ │ │ ├── fact │ │ │ │ ├── DataflowResult.java │ │ │ │ ├── MapFact.java │ │ │ │ ├── NodeResult.java │ │ │ │ └── SetFact.java │ │ │ ├── inter │ │ │ │ ├── AbstractInterDataflowAnalysis.java │ │ │ │ ├── InterConstantPropagation.java │ │ │ │ ├── InterDataflowAnalysis.java │ │ │ │ └── InterSolver.java │ │ │ ├── package-info.java │ │ │ └── solver │ │ │ │ ├── AbstractSolver.java │ │ │ │ ├── Solver.java │ │ │ │ └── WorkListSolver.java │ │ ├── deadcode │ │ │ └── DeadCodeDetection.java │ │ ├── defuse │ │ │ ├── DefUse.java │ │ │ └── DefUseAnalysis.java │ │ ├── exception │ │ │ ├── CatchAnalysis.java │ │ │ ├── CatchResult.java │ │ │ ├── ExplicitThrowAnalysis.java │ │ │ ├── ImplicitThrowAnalysis.java │ │ │ ├── IntraExplicitThrowAnalysis.java │ │ │ ├── PTABasedExplicitThrowAnalysis.java │ │ │ ├── ThrowAnalysis.java │ │ │ ├── ThrowResult.java │ │ │ └── package-info.java │ │ ├── graph │ │ │ ├── callgraph │ │ │ │ ├── AbstractCallGraph.java │ │ │ │ ├── CGBuilder.java │ │ │ │ ├── CHABuilder.java │ │ │ │ ├── CallGraph.java │ │ │ │ ├── CallGraphBuilder.java │ │ │ │ ├── CallGraphs.java │ │ │ │ ├── CallKind.java │ │ │ │ ├── DefaultCallGraph.java │ │ │ │ ├── Edge.java │ │ │ │ ├── MethodEdge.java │ │ │ │ ├── PTABasedBuilder.java │ │ │ │ └── package-info.java │ │ │ ├── cfg │ │ │ │ ├── AbstractCFG.java │ │ │ │ ├── CFG.java │ │ │ │ ├── CFGBuilder.java │ │ │ │ ├── CFGDumper.java │ │ │ │ ├── CFGEdge.java │ │ │ │ ├── CFGNodeIndexer.java │ │ │ │ ├── ExceptionalEdge.java │ │ │ │ ├── StmtCFG.java │ │ │ │ └── SwitchCaseEdge.java │ │ │ ├── flowgraph │ │ │ │ ├── ArrayIndexNode.java │ │ │ │ ├── BasicFlowEdge.java │ │ │ │ ├── FlowEdge.java │ │ │ │ ├── FlowGraphDumper.java │ │ │ │ ├── FlowKind.java │ │ │ │ ├── InstanceFieldNode.java │ │ │ │ ├── InstanceNode.java │ │ │ │ ├── Node.java │ │ │ │ ├── NodeManager.java │ │ │ │ ├── ObjectFlowGraph.java │ │ │ │ ├── StaticFieldNode.java │ │ │ │ └── VarNode.java │ │ │ └── icfg │ │ │ │ ├── AbstractICFG.java │ │ │ │ ├── CallEdge.java │ │ │ │ ├── CallToReturnEdge.java │ │ │ │ ├── DefaultICFG.java │ │ │ │ ├── ICFG.java │ │ │ │ ├── ICFGBuilder.java │ │ │ │ ├── ICFGEdge.java │ │ │ │ ├── NormalEdge.java │ │ │ │ ├── ReturnEdge.java │ │ │ │ └── package-info.java │ │ ├── misc │ │ │ ├── IRDumper.java │ │ │ └── ResultProcessor.java │ │ ├── pta │ │ │ ├── PointerAnalysis.java │ │ │ ├── PointerAnalysisResult.java │ │ │ ├── PointerAnalysisResultImpl.java │ │ │ ├── client │ │ │ │ ├── Collector.java │ │ │ │ ├── MayFailCast.java │ │ │ │ └── PolymorphicCallSite.java │ │ │ ├── core │ │ │ │ ├── cs │ │ │ │ │ ├── CSCallGraph.java │ │ │ │ │ ├── context │ │ │ │ │ │ ├── Context.java │ │ │ │ │ │ ├── ContextFactory.java │ │ │ │ │ │ └── TrieContext.java │ │ │ │ │ ├── element │ │ │ │ │ │ ├── AbstractCSElement.java │ │ │ │ │ │ ├── AbstractPointer.java │ │ │ │ │ │ ├── ArrayIndex.java │ │ │ │ │ │ ├── CSCallSite.java │ │ │ │ │ │ ├── CSElement.java │ │ │ │ │ │ ├── CSManager.java │ │ │ │ │ │ ├── CSMethod.java │ │ │ │ │ │ ├── CSObj.java │ │ │ │ │ │ ├── CSVar.java │ │ │ │ │ │ ├── InstanceField.java │ │ │ │ │ │ ├── MapBasedCSManager.java │ │ │ │ │ │ ├── Pointer.java │ │ │ │ │ │ ├── StaticField.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ └── selector │ │ │ │ │ │ ├── AbstractContextSelector.java │ │ │ │ │ │ ├── ContextInsensitiveSelector.java │ │ │ │ │ │ ├── ContextSelector.java │ │ │ │ │ │ ├── ContextSelectorFactory.java │ │ │ │ │ │ ├── GuidedSelector.java │ │ │ │ │ │ ├── KCallSelector.java │ │ │ │ │ │ ├── KLimitingSelector.java │ │ │ │ │ │ ├── KObjSelector.java │ │ │ │ │ │ ├── KTypeSelector.java │ │ │ │ │ │ ├── PruningSelector.java │ │ │ │ │ │ ├── SelectiveSelector.java │ │ │ │ │ │ └── package-info.java │ │ │ │ ├── heap │ │ │ │ │ ├── AbstractHeapModel.java │ │ │ │ │ ├── AllocationSiteBasedModel.java │ │ │ │ │ ├── ConstantObj.java │ │ │ │ │ ├── Descriptor.java │ │ │ │ │ ├── HeapModel.java │ │ │ │ │ ├── IsApplicationString.java │ │ │ │ │ ├── IsReflectionString.java │ │ │ │ │ ├── MergedObj.java │ │ │ │ │ ├── MockObj.java │ │ │ │ │ ├── NewObj.java │ │ │ │ │ ├── Obj.java │ │ │ │ │ └── package-info.java │ │ │ │ └── solver │ │ │ │ │ ├── DeclaredParamProvider.java │ │ │ │ │ ├── DefaultSolver.java │ │ │ │ │ ├── EmptyParamProvider.java │ │ │ │ │ ├── EntryPoint.java │ │ │ │ │ ├── Identity.java │ │ │ │ │ ├── ParamProvider.java │ │ │ │ │ ├── PointerFlowEdge.java │ │ │ │ │ ├── PointerFlowGraph.java │ │ │ │ │ ├── PropagateTypes.java │ │ │ │ │ ├── Solver.java │ │ │ │ │ ├── SpecifiedParamProvider.java │ │ │ │ │ ├── Transfer.java │ │ │ │ │ ├── TypeFilter.java │ │ │ │ │ ├── WorkList.java │ │ │ │ │ └── package-info.java │ │ │ ├── plugin │ │ │ │ ├── AnalysisTimer.java │ │ │ │ ├── ClassInitializer.java │ │ │ │ ├── CompositePlugin.java │ │ │ │ ├── ConstraintChecker.java │ │ │ │ ├── EntryPointHandler.java │ │ │ │ ├── NullHandler.java │ │ │ │ ├── NumberLiteralHandler.java │ │ │ │ ├── Plugin.java │ │ │ │ ├── Profiler.java │ │ │ │ ├── ReferenceHandler.java │ │ │ │ ├── ResultProcessor.java │ │ │ │ ├── ThreadHandler.java │ │ │ │ ├── exception │ │ │ │ │ ├── CSMethodThrowResult.java │ │ │ │ │ ├── ExceptionAnalysis.java │ │ │ │ │ ├── MethodThrowResult.java │ │ │ │ │ └── PTAThrowResult.java │ │ │ │ ├── invokedynamic │ │ │ │ │ ├── BSMCallEdge.java │ │ │ │ │ ├── InstanceInvoInfo.java │ │ │ │ │ ├── InvokeDynamicAnalysis.java │ │ │ │ │ ├── InvokeDynamicCallEdge.java │ │ │ │ │ ├── Java9StringConcatHandler.java │ │ │ │ │ ├── LambdaAnalysis.java │ │ │ │ │ ├── LambdaCallEdge.java │ │ │ │ │ ├── LookupModel.java │ │ │ │ │ └── MethodTypeModel.java │ │ │ │ ├── natives │ │ │ │ │ ├── ArrayModel.java │ │ │ │ │ ├── DoPriviledgedModel.java │ │ │ │ │ ├── NativeModeller.java │ │ │ │ │ └── UnsafeModel.java │ │ │ │ ├── package-info.java │ │ │ │ ├── reflection │ │ │ │ │ ├── AnnotationModel.java │ │ │ │ │ ├── DummyModel.java │ │ │ │ │ ├── InferenceModel.java │ │ │ │ │ ├── LogBasedModel.java │ │ │ │ │ ├── LogItem.java │ │ │ │ │ ├── MetaObjHelper.java │ │ │ │ │ ├── MethodInfo.java │ │ │ │ │ ├── OthersModel.java │ │ │ │ │ ├── ReflectionAnalysis.java │ │ │ │ │ ├── ReflectiveActionModel.java │ │ │ │ │ ├── ReflectiveCallEdge.java │ │ │ │ │ ├── SolarModel.java │ │ │ │ │ ├── StringBasedModel.java │ │ │ │ │ └── TypeMatcher.java │ │ │ │ ├── taint │ │ │ │ │ ├── CallSource.java │ │ │ │ │ ├── CallSourcePoint.java │ │ │ │ │ ├── EnhanceHandlerContext.java │ │ │ │ │ ├── EnhanceSink.java │ │ │ │ │ ├── EnhanceSinkHandler.java │ │ │ │ │ ├── EnhanceTaintAnalysis.java │ │ │ │ │ ├── EnhanceTaintConfig.java │ │ │ │ │ ├── EnhanceTaintManager.java │ │ │ │ │ ├── FieldSource.java │ │ │ │ │ ├── FieldSourcePoint.java │ │ │ │ │ ├── Handler.java │ │ │ │ │ ├── HandlerContext.java │ │ │ │ │ ├── OnFlyHandler.java │ │ │ │ │ ├── ParamSanitizer.java │ │ │ │ │ ├── ParamSource.java │ │ │ │ │ ├── ParamSourcePoint.java │ │ │ │ │ ├── Sanitizer.java │ │ │ │ │ ├── SanitizerHandler.java │ │ │ │ │ ├── Sink.java │ │ │ │ │ ├── SinkHandler.java │ │ │ │ │ ├── SinkPoint.java │ │ │ │ │ ├── Source.java │ │ │ │ │ ├── SourceHandler.java │ │ │ │ │ ├── SourcePoint.java │ │ │ │ │ ├── TFGBuilder.java │ │ │ │ │ ├── TFGDumper.java │ │ │ │ │ ├── TaintAnalysis.java │ │ │ │ │ ├── TaintConfig.java │ │ │ │ │ ├── TaintFlow.java │ │ │ │ │ ├── TaintFlowGraph.java │ │ │ │ │ ├── TaintManager.java │ │ │ │ │ ├── TaintTransfer.java │ │ │ │ │ ├── TransferHandler.java │ │ │ │ │ ├── TransferPoint.java │ │ │ │ │ ├── container │ │ │ │ │ │ └── spring │ │ │ │ │ │ │ ├── InjectFieldInfo.java │ │ │ │ │ │ │ ├── InjectParamInfo.java │ │ │ │ │ │ │ ├── InjectTargetInfo.java │ │ │ │ │ │ │ ├── SpringBean.java │ │ │ │ │ │ │ ├── SpringContainer.java │ │ │ │ │ │ │ └── Utils.java │ │ │ │ │ └── dynamic │ │ │ │ │ │ └── source │ │ │ │ │ │ └── SpringController.java │ │ │ │ └── util │ │ │ │ │ ├── AbstractIRModel.java │ │ │ │ │ ├── AbstractModel.java │ │ │ │ │ ├── CSObjs.java │ │ │ │ │ ├── DummyModel.java │ │ │ │ │ ├── IRModel.java │ │ │ │ │ ├── InvokeHandler.java │ │ │ │ │ ├── InvokeHandlers.java │ │ │ │ │ ├── InvokeUtils.java │ │ │ │ │ ├── Model.java │ │ │ │ │ ├── Reflections.java │ │ │ │ │ └── SolverHolder.java │ │ │ ├── pts │ │ │ │ ├── DelegatePointsToSet.java │ │ │ │ ├── HybridBitPointsToSet.java │ │ │ │ ├── HybridHashPointsToSet.java │ │ │ │ ├── PointsToSet.java │ │ │ │ ├── PointsToSetFactory.java │ │ │ │ └── package-info.java │ │ │ └── toolkit │ │ │ │ ├── CollectionMethods.java │ │ │ │ ├── PointerAnalysisResultEx.java │ │ │ │ ├── PointerAnalysisResultExImpl.java │ │ │ │ ├── mahjong │ │ │ │ ├── DFA.java │ │ │ │ ├── DFAEquivChecker.java │ │ │ │ ├── DFAFactory.java │ │ │ │ ├── DFAState.java │ │ │ │ ├── Field.java │ │ │ │ ├── FieldPointsToGraph.java │ │ │ │ ├── Mahjong.java │ │ │ │ ├── MahjongHeapModel.java │ │ │ │ ├── NFA.java │ │ │ │ └── package-info.java │ │ │ │ ├── pruning │ │ │ │ ├── DistancePruning.java │ │ │ │ └── Pruning.java │ │ │ │ ├── scaler │ │ │ │ ├── ContextComputer.java │ │ │ │ ├── Scaler.java │ │ │ │ ├── _1ObjContextComputer.java │ │ │ │ ├── _1TypeContextComputer.java │ │ │ │ ├── _2ObjContextComputer.java │ │ │ │ ├── _2TypeContextComputer.java │ │ │ │ ├── _InsensitiveContextComputer.java │ │ │ │ └── package-info.java │ │ │ │ ├── util │ │ │ │ └── OAGs.java │ │ │ │ └── zipper │ │ │ │ ├── ObjectAllocationGraph.java │ │ │ │ ├── PFGBuilder.java │ │ │ │ ├── PotentialContextElement.java │ │ │ │ ├── PrecisionFlowGraph.java │ │ │ │ ├── UnwrappedFlowEdge.java │ │ │ │ ├── WrappedFlowEdge.java │ │ │ │ ├── Zipper.java │ │ │ │ └── package-info.java │ │ └── sideeffect │ │ │ ├── SideEffect.java │ │ │ ├── SideEffectAnalysis.java │ │ │ ├── TopologicalSolver.java │ │ │ └── package-info.java │ │ ├── config │ │ ├── AnalysisConfig.java │ │ ├── AnalysisOptions.java │ │ ├── AnalysisPlanner.java │ │ ├── ConfigException.java │ │ ├── ConfigManager.java │ │ ├── Configs.java │ │ ├── LoggerConfigs.java │ │ ├── Options.java │ │ ├── OptionsHolder.java │ │ ├── Plan.java │ │ ├── PlanConfig.java │ │ ├── Scope.java │ │ └── package-info.java │ │ ├── frontend │ │ ├── asm │ │ │ └── package-info.java │ │ ├── cache │ │ │ ├── CachedIRBuilder.java │ │ │ └── CachedWorldBuilder.java │ │ ├── package-info.java │ │ └── soot │ │ │ ├── Converter.java │ │ │ ├── IRBuilder.java │ │ │ ├── MethodIRBuilder.java │ │ │ ├── Modifiers.java │ │ │ ├── SootClassBuilder.java │ │ │ ├── SootClassLoader.java │ │ │ ├── SootFrontendException.java │ │ │ ├── SootWorldBuilder.java │ │ │ └── VarManager.java │ │ ├── ir │ │ ├── DefaultIR.java │ │ ├── IR.java │ │ ├── IRBuildHelper.java │ │ ├── IRBuilder.java │ │ ├── IRPrinter.java │ │ ├── exp │ │ │ ├── AbstractBinaryExp.java │ │ │ ├── ArithmeticExp.java │ │ │ ├── ArrayAccess.java │ │ │ ├── ArrayLengthExp.java │ │ │ ├── BinaryExp.java │ │ │ ├── BitwiseExp.java │ │ │ ├── CastExp.java │ │ │ ├── ClassLiteral.java │ │ │ ├── ComparisonExp.java │ │ │ ├── ConditionExp.java │ │ │ ├── DoubleLiteral.java │ │ │ ├── Exp.java │ │ │ ├── ExpVisitor.java │ │ │ ├── Exps.java │ │ │ ├── FieldAccess.java │ │ │ ├── FloatLiteral.java │ │ │ ├── FloatingPointLiteral.java │ │ │ ├── InstanceFieldAccess.java │ │ │ ├── InstanceOfExp.java │ │ │ ├── IntLiteral.java │ │ │ ├── IntegerLiteral.java │ │ │ ├── InvokeDynamic.java │ │ │ ├── InvokeExp.java │ │ │ ├── InvokeInstanceExp.java │ │ │ ├── InvokeInterface.java │ │ │ ├── InvokeSpecial.java │ │ │ ├── InvokeStatic.java │ │ │ ├── InvokeVirtual.java │ │ │ ├── LValue.java │ │ │ ├── Literal.java │ │ │ ├── LongLiteral.java │ │ │ ├── MethodHandle.java │ │ │ ├── MethodType.java │ │ │ ├── NegExp.java │ │ │ ├── NewArray.java │ │ │ ├── NewExp.java │ │ │ ├── NewInstance.java │ │ │ ├── NewMultiArray.java │ │ │ ├── NullLiteral.java │ │ │ ├── NumberLiteral.java │ │ │ ├── RValue.java │ │ │ ├── ReferenceLiteral.java │ │ │ ├── ShiftExp.java │ │ │ ├── StaticFieldAccess.java │ │ │ ├── StringLiteral.java │ │ │ ├── UnaryExp.java │ │ │ └── Var.java │ │ ├── package-info.java │ │ ├── proginfo │ │ │ ├── ExceptionEntry.java │ │ │ ├── FieldRef.java │ │ │ ├── FieldResolutionFailedException.java │ │ │ ├── MemberRef.java │ │ │ ├── MethodRef.java │ │ │ ├── MethodResolutionFailedException.java │ │ │ └── ResolutionFailedException.java │ │ └── stmt │ │ │ ├── AbstractStmt.java │ │ │ ├── ArrayStmt.java │ │ │ ├── AssignLiteral.java │ │ │ ├── AssignStmt.java │ │ │ ├── Binary.java │ │ │ ├── Cast.java │ │ │ ├── Catch.java │ │ │ ├── Copy.java │ │ │ ├── DefinitionStmt.java │ │ │ ├── FieldStmt.java │ │ │ ├── Goto.java │ │ │ ├── If.java │ │ │ ├── InstanceOf.java │ │ │ ├── Invoke.java │ │ │ ├── JumpStmt.java │ │ │ ├── LoadArray.java │ │ │ ├── LoadField.java │ │ │ ├── LookupSwitch.java │ │ │ ├── Monitor.java │ │ │ ├── New.java │ │ │ ├── Nop.java │ │ │ ├── Return.java │ │ │ ├── Stmt.java │ │ │ ├── StmtVisitor.java │ │ │ ├── StoreArray.java │ │ │ ├── StoreField.java │ │ │ ├── SwitchStmt.java │ │ │ ├── TableSwitch.java │ │ │ ├── Throw.java │ │ │ └── Unary.java │ │ ├── language │ │ ├── annotation │ │ │ ├── Annotated.java │ │ │ ├── Annotation.java │ │ │ ├── AnnotationElement.java │ │ │ ├── AnnotationHolder.java │ │ │ ├── ArrayElement.java │ │ │ ├── BooleanElement.java │ │ │ ├── ClassElement.java │ │ │ ├── DoubleElement.java │ │ │ ├── Element.java │ │ │ ├── EnumElement.java │ │ │ ├── FloatElement.java │ │ │ ├── IntElement.java │ │ │ ├── LongElement.java │ │ │ ├── StringElement.java │ │ │ └── package-info.java │ │ ├── classes │ │ │ ├── AmbiguousMemberException.java │ │ │ ├── ClassHierarchy.java │ │ │ ├── ClassHierarchyImpl.java │ │ │ ├── ClassMember.java │ │ │ ├── ClassNames.java │ │ │ ├── JClass.java │ │ │ ├── JClassBuilder.java │ │ │ ├── JClassLoader.java │ │ │ ├── JField.java │ │ │ ├── JMethod.java │ │ │ ├── MethodNames.java │ │ │ ├── Modifier.java │ │ │ ├── Pattern.java │ │ │ ├── SignatureMatcher.java │ │ │ ├── Signatures.java │ │ │ ├── StringProvider.java │ │ │ ├── StringReps.java │ │ │ ├── Subsignature.java │ │ │ └── package-info.java │ │ ├── generics │ │ │ ├── ArrayTypeGSignature.java │ │ │ ├── BaseType.java │ │ │ ├── ClassGSignature.java │ │ │ ├── ClassGSignatureBuilder.java │ │ │ ├── ClassTypeGSignature.java │ │ │ ├── GSignatures.java │ │ │ ├── MethodGSignature.java │ │ │ ├── MethodGSignatureBuilder.java │ │ │ ├── ReferenceTypeGSignature.java │ │ │ ├── TypeArgument.java │ │ │ ├── TypeGSignature.java │ │ │ ├── TypeGSignatureBuilder.java │ │ │ ├── TypeParameter.java │ │ │ ├── TypeParameterAwareGSignatureBuilder.java │ │ │ ├── TypeVariableGSignature.java │ │ │ ├── VoidDescriptor.java │ │ │ └── package-info.java │ │ ├── natives │ │ │ ├── DefaultNativeModel.java │ │ │ ├── EmptyNativeModel.java │ │ │ ├── NativeModel.java │ │ │ └── package-info.java │ │ └── type │ │ │ ├── ArrayType.java │ │ │ ├── BottomType.java │ │ │ ├── ClassType.java │ │ │ ├── NullType.java │ │ │ ├── PrimitiveType.java │ │ │ ├── ReferenceType.java │ │ │ ├── Type.java │ │ │ ├── TypeSystem.java │ │ │ ├── TypeSystemImpl.java │ │ │ ├── VoidType.java │ │ │ └── package-info.java │ │ └── util │ │ ├── AbstractResultHolder.java │ │ ├── AnalysisException.java │ │ ├── Canonicalizer.java │ │ ├── ClassNameExtractor.java │ │ ├── Copyable.java │ │ ├── Experimental.java │ │ ├── Hashes.java │ │ ├── Indexable.java │ │ ├── Indexer.java │ │ ├── InternalCanonicalized.java │ │ ├── MutableInt.java │ │ ├── Predicates.java │ │ ├── ResultHolder.java │ │ ├── SimpleIndexer.java │ │ ├── Strings.java │ │ ├── Timer.java │ │ ├── TriConsumer.java │ │ ├── TriFunction.java │ │ ├── collection │ │ ├── AbstractBitSet.java │ │ ├── AbstractHybridMap.java │ │ ├── AbstractHybridSet.java │ │ ├── AbstractMultiMap.java │ │ ├── AbstractSetEx.java │ │ ├── AbstractTwoKeyMap.java │ │ ├── AbstractTwoKeyMultiMap.java │ │ ├── ArrayMap.java │ │ ├── ArraySet.java │ │ ├── CollectionUtils.java │ │ ├── GenericBitSet.java │ │ ├── HybridBitSet.java │ │ ├── HybridHashMap.java │ │ ├── HybridHashSet.java │ │ ├── HybridIndexableSet.java │ │ ├── HybridLinkedHashSet.java │ │ ├── IBitSet.java │ │ ├── ImmutableMapEntry.java │ │ ├── IndexMap.java │ │ ├── IndexableSet.java │ │ ├── IndexerBitSet.java │ │ ├── Lists.java │ │ ├── MapEntry.java │ │ ├── MapMapTwoKeyMap.java │ │ ├── MapMultiMapTwoKeyMultiMap.java │ │ ├── MapSetMultiMap.java │ │ ├── Maps.java │ │ ├── MultiMap.java │ │ ├── MultiMapCollector.java │ │ ├── Pair.java │ │ ├── RegularBitSet.java │ │ ├── SetEx.java │ │ ├── SetQueue.java │ │ ├── Sets.java │ │ ├── SparseBitSet.java │ │ ├── Streams.java │ │ ├── TooManyElementsException.java │ │ ├── TwoKeyMap.java │ │ ├── TwoKeyMultiMap.java │ │ ├── UnionFindSet.java │ │ ├── UnmodifiableMultiMap.java │ │ ├── UnmodifiableTwoKeyMultiMap.java │ │ └── Views.java │ │ ├── function │ │ └── SSupplier.java │ │ └── graph │ │ ├── AbstractEdge.java │ │ ├── DominatorFinder.java │ │ ├── DotAttributes.java │ │ ├── DotDumper.java │ │ ├── Edge.java │ │ ├── Graph.java │ │ ├── MergedNode.java │ │ ├── MergedSCCGraph.java │ │ ├── Reachability.java │ │ ├── ReverseGraph.java │ │ ├── SCC.java │ │ ├── SimpleEdge.java │ │ ├── SimpleGraph.java │ │ └── TopologicalSorter.java └── resources │ ├── basic-classes.yml │ ├── entry │ └── youlai-mall.json │ ├── javax.servlet-api-3.1.0.jar │ ├── log4j2.yml │ ├── mybatis-3-mapper.dtd │ ├── options.yml │ ├── tai-e-analyses.yml │ └── taint-config.yml └── test ├── java └── pascal │ └── taie │ ├── TaieTestSuite.java │ ├── analysis │ ├── Tests.java │ ├── bugfinder │ │ ├── BugFinderTestSuite.java │ │ ├── CloneIdiomTest.java │ │ ├── DroppedExceptionTest.java │ │ ├── IsNullTest.java │ │ └── NullPointerDetectionTest.java │ ├── dataflow │ │ ├── DataflowTestSuite.java │ │ ├── analysis │ │ │ ├── AvailExpTest.java │ │ │ ├── LiveVarTest.java │ │ │ ├── LiveVarTestFull.java │ │ │ ├── ReachDefTest.java │ │ │ └── constprop │ │ │ │ ├── CPTest.java │ │ │ │ ├── CPTestFull.java │ │ │ │ ├── CPTestSuite.java │ │ │ │ ├── EdgeRefineTest.java │ │ │ │ ├── InterCPAliasTest.java │ │ │ │ ├── InterCPAliasTestFull.java │ │ │ │ ├── InterCPTest.java │ │ │ │ ├── InterCPTestFull.java │ │ │ │ ├── MeetValueTest.java │ │ │ │ └── ValueTest.java │ │ └── fact │ │ │ └── FactTest.java │ ├── deadcode │ │ ├── DeadCodeTest.java │ │ └── DeadCodeTestFull.java │ ├── defuse │ │ └── DefUseTest.java │ ├── exception │ │ └── ExceptionTest.java │ ├── graph │ │ ├── callgraph │ │ │ └── cha │ │ │ │ ├── CHATest.java │ │ │ │ └── CHATestFull.java │ │ └── cfg │ │ │ └── CFGTest.java │ ├── pta │ │ ├── BasicTest.java │ │ ├── BasicTestFull.java │ │ ├── BenchmarkInfo.java │ │ ├── BenchmarkRunner.java │ │ ├── ContextSensitivityTest.java │ │ ├── ContextSensitivityTestFull.java │ │ ├── CustomEntryPointPlugin.java │ │ ├── CustomEntryPointTest.java │ │ ├── ExceptionTest.java │ │ ├── Java9StringConcatTest.java │ │ ├── LambdaTest.java │ │ ├── PTATestSuite.java │ │ ├── ReflectionTest.java │ │ ├── TaintTest.java │ │ ├── WorldCacheTest.java │ │ ├── core │ │ │ └── cs │ │ │ │ └── context │ │ │ │ └── ContextTest.java │ │ └── toolkit │ │ │ └── zipper │ │ │ └── ZipperTest.java │ └── sideeffect │ │ └── SideEffectTest.java │ ├── config │ ├── AnalysisOptionsTest.java │ └── OptionsTest.java │ ├── frontend │ ├── cache │ │ └── SerializationTest.java │ └── soot │ │ ├── AnnotationPrinter.java │ │ ├── AnnotationTest.java │ │ ├── ConstVarTest.java │ │ ├── IRTest.java │ │ ├── InvokeDynamicTest.java │ │ ├── OuterInnerTest.java │ │ └── SootFrontendTest.java │ ├── ir │ ├── IRTest.java │ └── LiteralTest.java │ ├── language │ ├── DefaultMethodTest.java │ ├── FieldTest.java │ ├── HierarchyTest.java │ ├── TypeTest.java │ ├── classes │ │ └── StringRepsTest.java │ └── generics │ │ └── GSignaturesTest.java │ └── util │ ├── IndexerTest.java │ ├── MultiStringsSource.java │ ├── MultiStringsSourceArgumentsProvider.java │ ├── MultiStringsSources.java │ ├── SerializationUtils.java │ ├── UtilTestSuite.java │ ├── collection │ ├── AbstractMapTest.java │ ├── AbstractSetTest.java │ ├── ArrayMapTest.java │ ├── ArraySetTest.java │ ├── CollectionTestSuite.java │ ├── GenericBitSetTest.java │ ├── HybridHashMapTest.java │ ├── HybridHashSetTest.java │ ├── IBitSetTest.java │ ├── IndexMapTest.java │ ├── MultiMapTest.java │ ├── RegularBitSetTest.java │ ├── SetQueueTest.java │ ├── SparseBitSetTest.java │ ├── StreamsTest.java │ ├── TwoKeyMapTest.java │ ├── TwoKeyMultiMapTest.java │ └── ViewsTest.java │ └── graph │ └── GraphTest.java └── resources ├── bugfinder ├── CloneIdiom │ ├── CloneIdiom1-clone-idiom-expected.txt │ ├── CloneIdiom1.java │ ├── CloneIdiom2-clone-idiom-expected.txt │ ├── CloneIdiom2.java │ ├── CloneIdiom3-clone-idiom-expected.txt │ ├── CloneIdiom3.java │ ├── CloneIdiom4-clone-idiom-expected.txt │ └── CloneIdiom4.java ├── DroppedException-dropped-exception-expected.txt ├── DroppedException.java ├── NullAnnotation.java ├── NullDeref-is-null-expected.txt ├── NullDeref-null-pointer-expected.txt ├── NullDeref.java ├── NullDeref2-is-null-expected.txt ├── NullDeref2-null-pointer-expected.txt ├── NullDeref2.java ├── NullDeref3-null-pointer-expected.txt └── NullDeref3.java ├── cha ├── AbstractMethod-cg-expected.txt ├── AbstractMethod.java ├── CHACP.java ├── InterestingSpecial.java ├── Interface-cg-expected.txt ├── Interface.java ├── Interface2-cg-expected.txt ├── Interface2.java ├── Interface3-cg-expected.txt ├── Interface3.java ├── LongCallChain-cg-expected.txt ├── LongCallChain.java ├── MaxPQ-cg-expected.txt ├── MaxPQ.java ├── Recursion-cg-expected.txt ├── Recursion.java ├── Recursion2-cg-expected.txt ├── Recursion2.java ├── SpecialCall-cg-expected.txt ├── SpecialCall.java ├── StaticCall-cg-expected.txt ├── StaticCall.java ├── VirtualCall-cg-expected.txt └── VirtualCall.java ├── controlflow ├── CFG.java └── Exceptions.java ├── dataflow ├── AvailExp-avail-exp-expected.txt ├── AvailExp.java ├── ReachDef-reach-def-expected.txt ├── ReachDef.java ├── constprop │ ├── Assign-const-prop-expected.txt │ ├── Assign.java │ ├── BinaryOp-const-prop-expected.txt │ ├── BinaryOp.java │ ├── BranchConstant-const-prop-expected.txt │ ├── BranchConstant.java │ ├── BranchNAC-const-prop-expected.txt │ ├── BranchNAC.java │ ├── BranchUndef-const-prop-expected.txt │ ├── BranchUndef.java │ ├── ComparisonOp-const-prop-expected.txt │ ├── ComparisonOp.java │ ├── ConditionOp-const-prop-expected.txt │ ├── ConditionOp.java │ ├── DivisionByZero-const-prop-expected.txt │ ├── DivisionByZero.java │ ├── EdgeRefine-const-prop-expected.txt │ ├── EdgeRefine.java │ ├── Interprocedural-const-prop-expected.txt │ ├── Interprocedural.java │ ├── LogicalOp-const-prop-expected.txt │ ├── LogicalOp.java │ ├── Loop-const-prop-expected.txt │ ├── Loop.java │ ├── MultiplyByZero-const-prop-expected.txt │ ├── MultiplyByZero.java │ ├── SameVarNames.java │ ├── SimpleBinary-const-prop-expected.txt │ ├── SimpleBinary.java │ ├── SimpleBoolean-const-prop-expected.txt │ ├── SimpleBoolean.java │ ├── SimpleBranch-const-prop-expected.txt │ ├── SimpleBranch.java │ ├── SimpleChar-const-prop-expected.txt │ ├── SimpleChar.java │ ├── SimpleConstant-const-prop-expected.txt │ ├── SimpleConstant.java │ ├── alias │ │ ├── Array-inter-const-prop-expected.txt │ │ ├── Array.java │ │ ├── ArrayCorner-inter-const-prop-expected.txt │ │ ├── ArrayCorner.java │ │ ├── ArrayField-inter-const-prop-expected.txt │ │ ├── ArrayField.java │ │ ├── ArrayInField-inter-const-prop-expected.txt │ │ ├── ArrayInField.java │ │ ├── ArrayInter-inter-const-prop-expected.txt │ │ ├── ArrayInter.java │ │ ├── ArrayInter2-inter-const-prop-expected.txt │ │ ├── ArrayInter2.java │ │ ├── ArrayLoops-inter-const-prop-expected.txt │ │ ├── ArrayLoops.java │ │ ├── FieldCorner-inter-const-prop-expected.txt │ │ ├── FieldCorner.java │ │ ├── InheritedField-inter-const-prop-expected.txt │ │ ├── InheritedField.java │ │ ├── InstanceField-inter-const-prop-expected.txt │ │ ├── InstanceField.java │ │ ├── Interprocedural-inter-const-prop-expected.txt │ │ ├── Interprocedural.java │ │ ├── Interprocedural2-inter-const-prop-expected.txt │ │ ├── Interprocedural2.java │ │ ├── MaxPQ-inter-const-prop-expected.txt │ │ ├── MaxPQ.java │ │ ├── MultiLoads-inter-const-prop-expected.txt │ │ ├── MultiLoads.java │ │ ├── MultiObjs-inter-const-prop-expected.txt │ │ ├── MultiObjs.java │ │ ├── MultiStores-inter-const-prop-expected.txt │ │ ├── MultiStores.java │ │ ├── ObjSens-inter-const-prop-expected.txt │ │ ├── ObjSens.java │ │ ├── ObjSens2-inter-const-prop-expected.txt │ │ ├── ObjSens2.java │ │ ├── Reference-inter-const-prop-expected.txt │ │ ├── Reference.java │ │ ├── StaticField-inter-const-prop-expected.txt │ │ ├── StaticField.java │ │ ├── StaticFieldMultiStores-inter-const-prop-expected.txt │ │ └── StaticFieldMultiStores.java │ └── inter │ │ ├── ArgRet-inter-const-prop-expected.txt │ │ ├── ArgRet.java │ │ ├── Call-inter-const-prop-expected.txt │ │ ├── Call.java │ │ ├── CharArgs-inter-const-prop-expected.txt │ │ ├── CharArgs.java │ │ ├── DeadLoop-inter-const-prop-expected.txt │ │ ├── DeadLoop.java │ │ ├── Example-inter-const-prop-expected.txt │ │ ├── Example.java │ │ ├── Fibonacci-inter-const-prop-expected.txt │ │ ├── Fibonacci.java │ │ ├── FloatArg-inter-const-prop-expected.txt │ │ ├── FloatArg.java │ │ ├── MultiIntArgs-inter-const-prop-expected.txt │ │ ├── MultiIntArgs.java │ │ ├── MultiReturn-inter-const-prop-expected.txt │ │ ├── MultiReturn.java │ │ ├── PlusPlus-inter-const-prop-expected.txt │ │ ├── PlusPlus.java │ │ ├── RedBlackBST-inter-const-prop-expected.txt │ │ ├── RedBlackBST.java │ │ ├── Reference-inter-const-prop-expected.txt │ │ └── Reference.java └── livevar │ ├── AnonInner-live-var-expected.txt │ ├── AnonInner.java │ ├── Array-live-var-expected.txt │ ├── Array.java │ ├── Assign-live-var-expected.txt │ ├── Assign.java │ ├── Branch-live-var-expected.txt │ ├── Branch.java │ ├── BranchLoop-live-var-expected.txt │ ├── BranchLoop.java │ ├── ComplexAssign-live-var-expected.txt │ ├── ComplexAssign.java │ ├── Corner-live-var-expected.txt │ ├── Corner.java │ ├── Fibonacci-live-var-expected.txt │ ├── Fibonacci.java │ ├── Field-live-var-expected.txt │ ├── Field.java │ ├── GaussianElimination-live-var-expected.txt │ ├── GaussianElimination.java │ ├── Graph-live-var-expected.txt │ ├── Graph.java │ ├── Invoke-live-var-expected.txt │ ├── Invoke.java │ ├── Loop-live-var-expected.txt │ ├── Loop.java │ ├── Reference-live-var-expected.txt │ ├── Reference.java │ ├── Sort-live-var-expected.txt │ ├── Sort.java │ ├── StronglyAssign-live-var-expected.txt │ ├── StronglyAssign.java │ ├── StronglyBranchLoop-live-var-expected.txt │ ├── StronglyBranchLoop.java │ ├── Switch-live-var-expected.txt │ └── Switch.java ├── deadcode ├── AllReachableIfBranch-dead-code-expected.txt ├── AllReachableIfBranch.java ├── ArrayField-dead-code-expected.txt ├── ArrayField.java ├── ControlFlowUnreachable-dead-code-expected.txt ├── ControlFlowUnreachable.java ├── ControlFlowUnreachable2-dead-code-expected.txt ├── ControlFlowUnreachable2.java ├── Corner-dead-code-expected.txt ├── Corner.java ├── DeadAssignment-dead-code-expected.txt ├── DeadAssignment.java ├── DeadAssignment2-dead-code-expected.txt ├── DeadAssignment2.java ├── ForLoops-dead-code-expected.txt ├── ForLoops.java ├── LiveAssignments-dead-code-expected.txt ├── LiveAssignments.java ├── Loops-dead-code-expected.txt ├── Loops.java ├── MixedDeadCode-dead-code-expected.txt ├── MixedDeadCode.java ├── NotDead-dead-code-expected.txt ├── NotDead.java ├── UnreachableIfBranch-dead-code-expected.txt ├── UnreachableIfBranch.java ├── UnreachableIfBranch2-dead-code-expected.txt ├── UnreachableIfBranch2.java ├── UnreachableSwitchBranch-dead-code-expected.txt ├── UnreachableSwitchBranch.java ├── UnreachableSwitchBranch2-dead-code-expected.txt └── UnreachableSwitchBranch2.java ├── defuse ├── DefUse-def-use-expected.txt └── DefUse.java ├── pta ├── basic │ ├── Annotations-pta-expected.txt │ ├── Annotations.java │ ├── Array-pta-expected.txt │ ├── Array.java │ ├── Assign-pta-expected.txt │ ├── Assign.java │ ├── Assign2-pta-expected.txt │ ├── Assign2.java │ ├── Call-pta-expected.txt │ ├── Call.java │ ├── CallField-pta-expected.txt │ ├── CallField.java │ ├── CallParamRet-pta-expected.txt │ ├── CallParamRet.java │ ├── Cast-pta-expected.txt │ ├── Cast.java │ ├── Cast2-pta-expected.txt │ ├── Cast2.java │ ├── ClassObj$A.class │ ├── ClassObj-pta-expected.txt │ ├── ClassObj.class │ ├── ClassObj.java │ ├── Clinit-pta-expected.txt │ ├── Clinit.java │ ├── ComplexAssign-pta-expected.txt │ ├── ComplexAssign.java │ ├── Cycle-pta-expected.txt │ ├── Cycle.java │ ├── Dispatch-pta-expected.txt │ ├── Dispatch.java │ ├── Dispatch2$C1.class │ ├── Dispatch2$I1.class │ ├── Dispatch2$I2.class │ ├── Dispatch2$I3.class │ ├── Dispatch2$I4.class │ ├── Dispatch2-pta-expected.txt │ ├── Dispatch2.class │ ├── Dispatch2.java │ ├── InstanceField-pta-expected.txt │ ├── InstanceField.java │ ├── InstanceField2-pta-expected.txt │ ├── InstanceField2.java │ ├── Interface-pta-expected.txt │ ├── Interface.java │ ├── LinkedQueue-pta-expected.txt │ ├── LinkedQueue.java │ ├── MergeParam-pta-expected.txt │ ├── MergeParam.java │ ├── MultiArray-pta-expected.txt │ ├── MultiArray.java │ ├── MultiReturn-pta-expected.txt │ ├── MultiReturn.java │ ├── Native-pta-expected.txt │ ├── Native.java │ ├── NativeModel-pta-expected.txt │ ├── NativeModel.java │ ├── New-pta-expected.txt │ ├── New.java │ ├── Null-pta-expected.txt │ ├── Null.java │ ├── Primitive-pta-expected.txt │ ├── Primitive.java │ ├── Primitives-pta-expected.txt │ ├── Primitives.java │ ├── PropagateNull-pta-expected.txt │ ├── PropagateNull.java │ ├── Recursion-pta-expected.txt │ ├── Recursion.java │ ├── RedBlackBST-pta-expected.txt │ ├── RedBlackBST.java │ ├── StaticCall-pta-expected.txt │ ├── StaticCall.java │ ├── StaticField-pta-expected.txt │ ├── StaticField.java │ ├── StoreLoad-pta-expected.txt │ ├── StoreLoad.java │ ├── Strings-pta-expected.txt │ └── Strings.java ├── contextsensitivity │ ├── CallOnly-pta-expected.txt │ ├── CallOnly.java │ ├── LinkedQueue-pta-expected.txt │ ├── LinkedQueue.java │ ├── LongCallContext-pta-expected.txt │ ├── LongCallContext.java │ ├── LongObjContext-pta-expected.txt │ ├── LongObjContext.java │ ├── MustUseHeap-pta-expected.txt │ ├── MustUseHeap.java │ ├── NestedHeap-pta-expected.txt │ ├── NestedHeap.java │ ├── ObjOnly-pta-expected.txt │ ├── ObjOnly.java │ ├── OneCall-pta-expected.txt │ ├── OneCall.java │ ├── OneObject-pta-expected.txt │ ├── OneObject.java │ ├── OneType-pta-expected.txt │ ├── OneType.java │ ├── RecursiveObj-pta-expected.txt │ ├── RecursiveObj.java │ ├── SpecialHeapContext-pta-expected.txt │ ├── SpecialHeapContext.java │ ├── StaticSelect-pta-expected.txt │ ├── StaticSelect.java │ ├── TwoCall-pta-expected.txt │ ├── TwoCall.java │ ├── TwoCallOnly-pta-expected.txt │ ├── TwoCallOnly.java │ ├── TwoObject-pta-expected.txt │ ├── TwoObject.java │ ├── TwoType-pta-expected.txt │ ├── TwoType.java │ ├── TypeSens-pta-expected.txt │ ├── TypeSens.class │ └── TypeSens.java ├── entrypoint │ └── CustomEntryPoints.java ├── exception │ ├── ExceptionCircle-pta-expected.txt │ ├── ExceptionCircle.java │ ├── ExceptionCircleAndRecursion-pta-expected.txt │ ├── ExceptionCircleAndRecursion.java │ ├── ExceptionFromClinit-pta-expected.txt │ ├── ExceptionFromClinit.java │ ├── ExceptionNoneCaught-pta-expected.txt │ ├── ExceptionNoneCaught.java │ ├── ExceptionTreeAndRecursion-pta-expected.txt │ └── ExceptionTreeAndRecursion.java ├── invokedynamic │ ├── A.class │ ├── A.java │ ├── Capture.class │ ├── Capture.java │ ├── Function.class │ ├── Function.java │ ├── Interface.class │ ├── Interface.java │ ├── InvokedynamicClass.class │ ├── Java9StringConcatenation$MyClass.class │ ├── Java9StringConcatenation$MyClassNull.class │ ├── Java9StringConcatenation.class │ ├── Java9StringConcatenation.java │ ├── Main.class │ ├── Main.java │ ├── MethodTypes.class │ ├── MethodTypes.java │ ├── MultiStatement.class │ ├── MultiStatement.java │ ├── WithArgs.class │ └── WithArgs.java ├── lambda │ ├── Args$A.class │ ├── Args-pta-expected.txt │ ├── Args.class │ ├── Args.java │ ├── B.class │ ├── B.java │ ├── DispatchBugDueToLackOfSubclassCheck$ClassWithInstanceMethod.class │ ├── DispatchBugDueToLackOfSubclassCheck$ClassWithStaticMethod.class │ ├── DispatchBugDueToLackOfSubclassCheck-pta-expected.txt │ ├── DispatchBugDueToLackOfSubclassCheck.class │ ├── DispatchBugDueToLackOfSubclassCheck.java │ ├── ImpreciseLambdas-pta-expected.txt │ ├── ImpreciseLambdas.class │ ├── ImpreciseLambdas.java │ ├── LambdaConstructor$A.class │ ├── LambdaConstructor-pta-expected.txt │ ├── LambdaConstructor.class │ ├── LambdaConstructor.java │ ├── LambdaInstanceMethod$A.class │ ├── LambdaInstanceMethod$B.class │ ├── LambdaInstanceMethod$C.class │ ├── LambdaInstanceMethod$I.class │ ├── LambdaInstanceMethod-pta-expected.txt │ ├── LambdaInstanceMethod.class │ ├── LambdaInstanceMethod.java │ ├── LambdaStaticMethod$GT.class │ ├── LambdaStaticMethod$LE.class │ ├── LambdaStaticMethod$Op.class │ ├── LambdaStaticMethod-pta-expected.txt │ ├── LambdaStaticMethod.class │ ├── LambdaStaticMethod.java │ ├── NativeModelWithLambda$A.class │ ├── NativeModelWithLambda-pta-expected.txt │ ├── NativeModelWithLambda.class │ ├── NativeModelWithLambda.java │ ├── Streams.class │ └── Streams.java ├── misc │ ├── DefaultMethod$C.class │ ├── DefaultMethod$I.class │ ├── DefaultMethod.class │ ├── DefaultMethod.java │ ├── TestMap.java │ ├── Threads.java │ └── Zipper.java ├── reflection │ ├── ArgsRefine-pta-expected.txt │ ├── ArgsRefine.java │ ├── GetMember-pta-expected.txt │ ├── GetMember.class │ ├── GetMember.java │ ├── GetMethods-pta-expected.txt │ ├── GetMethods.java │ ├── LazyHeapModeling-pta-expected.txt │ ├── LazyHeapModeling.java │ ├── ReflectiveAction-pta-expected.txt │ ├── ReflectiveAction.class │ ├── ReflectiveAction.java │ ├── ReflectiveAction.log │ ├── U.java │ ├── UnknownMethodName-pta-expected.txt │ ├── UnknownMethodName.java │ ├── V.java │ └── W.java └── taint │ ├── ArgToResult-pta-expected.txt │ ├── ArgToResult.java │ ├── ArrayFieldTransfer-pta-expected.txt │ ├── ArrayFieldTransfer.java │ ├── ArrayTaint-pta-expected.txt │ ├── ArrayTaint.java │ ├── BackPropagation-pta-expected.txt │ ├── BackPropagation.java │ ├── BaseToResult-pta-expected.txt │ ├── BaseToResult.java │ ├── CSBackPropagation-pta-expected.txt │ ├── CSBackPropagation.java │ ├── CSTaint-pta-expected.txt │ ├── CSTaint.java │ ├── CallSiteMode-pta-expected.txt │ ├── CallSiteMode.java │ ├── CharArray-pta-expected.txt │ ├── CharArray.java │ ├── ComplexTaint-pta-expected.txt │ ├── ComplexTaint.java │ ├── CycleTaint-pta-expected.txt │ ├── CycleTaint.java │ ├── FieldTaint-pta-expected.txt │ ├── FieldTaint.java │ ├── InstanceSourceSink-pta-expected.txt │ ├── InstanceSourceSink.java │ ├── InterTaintTransfer-pta-expected.txt │ ├── InterTaintTransfer.java │ ├── Java9StringConcat-pta-expected.txt │ ├── Java9StringConcat.class │ ├── Java9StringConcat.java │ ├── LinkedQueue-pta-expected.txt │ ├── LinkedQueue.java │ ├── OneCallTaint-pta-expected.txt │ ├── OneCallTaint.java │ ├── Sanitizer.java │ ├── SimpleTaint-pta-expected.txt │ ├── SimpleTaint.java │ ├── SourceSink.java │ ├── StaticTaintTransfer-pta-expected.txt │ ├── StaticTaintTransfer.java │ ├── StringAppend-pta-expected.txt │ ├── StringAppend.java │ ├── TaintCorner-pta-expected.txt │ ├── TaintCorner.java │ ├── TaintInList-pta-expected.txt │ ├── TaintInList.java │ ├── TaintParam-pta-expected.txt │ ├── TaintParam.java │ ├── TwoObjectTaint-pta-expected.txt │ ├── TwoObjectTaint.java │ ├── taint-config-array-field-transfer.yml │ ├── taint-config-call-site-model.yml │ ├── taint-config-instance-source-sink.yml │ ├── taint-config-param-source.yml │ ├── taint-config-static-taint-transfer.yml │ └── taint-config.yml ├── sideeffect ├── Arrays-side-effect-expected.txt ├── Arrays.java ├── BubbleSort-side-effect-expected.txt ├── BubbleSort.java ├── ConstructorTest-side-effect-expected.txt ├── ConstructorTest.java ├── Globals-side-effect-expected.txt ├── Globals.java ├── Inheritance-side-effect-expected.txt ├── Inheritance.java ├── InterProc-side-effect-expected.txt ├── InterProc.java ├── LinkedList-side-effect-expected.txt ├── LinkedList.java ├── Loops-side-effect-expected.txt ├── Loops.java ├── Milanova-side-effect-expected.txt ├── Milanova.java ├── Null-side-effect-expected.txt ├── Null.java ├── OOP-side-effect-expected.txt ├── OOP.java ├── PolyLoop-side-effect-expected.txt ├── PolyLoop.java ├── PrimitiveTest-side-effect-expected.txt ├── PrimitiveTest.java ├── PureTest-side-effect-expected.txt ├── PureTest.java ├── Recursion-side-effect-expected.txt ├── Recursion.java ├── SideEffects-side-effect-expected.txt ├── SideEffects.java ├── SimpleCases-side-effect-expected.txt ├── SimpleCases.java ├── StaticStore-side-effect-expected.txt └── StaticStore.java ├── util ├── graph-dominator.txt ├── graph-scc.txt ├── graph-simple.txt └── graph-topsort.txt └── world ├── AllInOne.java ├── Anno.class ├── Annotated.class ├── Annotated.java ├── AnnotatedJava.java ├── Author.class ├── Cards.class ├── ClassAnno.class ├── ConstVar.java ├── Copyright.class ├── DefUse.java ├── DefaultMethod$A.class ├── DefaultMethod$B.class ├── DefaultMethod$C.class ├── DefaultMethod$I.class ├── DefaultMethod$II.class ├── DefaultMethod.class ├── DefaultMethod.java ├── FieldsWithSameName.class ├── Hierarchy.java ├── IntAnno.class ├── Mahjong.class ├── Name.class ├── OuterInner.java ├── StringAnno.class ├── Switch.java ├── TestDumper.java ├── Types.java ├── Year.class └── android$widget$RemoteViews$BaseReflectionAction.class /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | tab_width = 4 7 | indent_size = 4 8 | indent_style = space 9 | ij_continuation_indent_size = 8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | max_line_length = 100 13 | 14 | [*.{yml, yaml}] 15 | indent_size = 2 16 | tab_width = 2 17 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.txt text eol=lf 3 | *.java text eol=lf 4 | *.kts text eol=lf 5 | *.yml text eol=lf 6 | *.md text eol=lf 7 | *.xml text eol=lf 8 | *.html text eol=lf 9 | *.css text eol=lf 10 | *.adoc text eol=lf 11 | *.bat text eol=crlf 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # macOS hidden file 2 | .DS_Store 3 | .gradle/ 4 | .idea/ 5 | bin/ 6 | build/ 7 | out/ 8 | output/ 9 | results/ 10 | options-*.yml 11 | java-benchmarks/ 12 | Config.java 13 | output* 14 | hs_err_pid*.log 15 | __pycache__ 16 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "java-benchmarks"] 2 | path = java-benchmarks 3 | url = https://github.com/pascal-lab/java-benchmarks 4 | branch = master 5 | -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | `kotlin-dsl` 3 | id("java-gradle-plugin") 4 | } 5 | 6 | repositories { 7 | // Use the plugin portal to apply community plugins in convention plugins. 8 | gradlePluginPortal() 9 | } 10 | -------------------------------------------------------------------------------- /config/checkstyle/java.header: -------------------------------------------------------------------------------- 1 | /* 2 | * Tai-e: A Static Analysis Framework for Java 3 | * 4 | * Copyright (C) 2022 Tian Tan 5 | * Copyright (C) 2022 Yue Li 6 | * 7 | * This file is part of Tai-e. 8 | * 9 | * Tai-e is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License 11 | * as published by the Free Software Foundation, either version 3 12 | * of the License, or (at your option) any later version. 13 | * 14 | * Tai-e is distributed in the hope that it will be useful,but WITHOUT 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 17 | * Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with Tai-e. If not, see . 21 | */ 22 | 23 | -------------------------------------------------------------------------------- /config/javadoc/javadoc.css: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS customizations for Tai-e 3 | */ 4 | 5 | h1 { 6 | font-size: 32px; 7 | } 8 | 9 | a, a:focus { 10 | color: #000000; 11 | } 12 | 13 | ul.nav-list a { 14 | color: #000000; 15 | } 16 | 17 | .top-nav li { 18 | color: #000000; 19 | } 20 | 21 | .caption span { 22 | border-radius: 1px; 23 | } 24 | 25 | #search-input { 26 | width: 200px; 27 | } 28 | 29 | .about-language { 30 | padding: 0 0 0 0; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /config/javadoc/overview.html: -------------------------------------------------------------------------------- 1 | 2 | Tai-e is an easy-to-learn/use static analysis framework for Java. 3 | 4 | -------------------------------------------------------------------------------- /docs/common/css/custom.css: -------------------------------------------------------------------------------- 1 | #banner-container { 2 | height: unset; 3 | } 4 | 5 | #banner { 6 | background-image: unset; 7 | } 8 | 9 | html.dark-theme #banner { 10 | background-image: unset; 11 | } 12 | 13 | #doc { 14 | background-image: unset; 15 | } 16 | 17 | html.dark-theme #doc { 18 | background-image: unset; 19 | } 20 | 21 | @media screen and (max-width: 800px) { 22 | html.dark-theme #doc, 23 | #doc { 24 | background: none; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /docs/common/img/pointer-analysis-framework-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/pointer-analysis-framework-1.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-1.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-2.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-3.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-4.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-5.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-6.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-7.png -------------------------------------------------------------------------------- /docs/common/img/setup-in-intellij-idea-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/docs/common/img/setup-in-intellij-idea-8.png -------------------------------------------------------------------------------- /docs/en/attributes.adoc: -------------------------------------------------------------------------------- 1 | :doctype: book 2 | :idprefix: 3 | :idseparator: - 4 | :toc: left 5 | :toclevels: 4 6 | :tabsize: 4 7 | :numbered: 8 | :sectanchors: 9 | :sectnums: 10 | :hide-uri-scheme: 11 | :docinfo: shared 12 | :attribute-missing: warn 13 | :source-highlighter: coderay 14 | :chomp: default headers packages 15 | :authors: Tian Tan; Yue Li; Teng Zhang 16 | -------------------------------------------------------------------------------- /docs/en/docinfo.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/en/index-single.adoc: -------------------------------------------------------------------------------- 1 | include::attributes.adoc[] 2 | 3 | = Tai-e Reference Documentation 4 | 5 | ifndef::backend-pdf[] 6 | This documentation is also available as link:index.html[multiple HTML pages]. 7 | // and as link:index-single.pdf[a PDF]. 8 | endif::[] 9 | // ifdef::backend-pdf[] 10 | // This documentation is also available as https://domain/{revnumber}/html/index.html[multiple HTML pages] and as https://domain/{revnumber}/html/index.htmlindex-single.html[a single-page html]. 11 | // endif::[] 12 | 13 | include::setup-in-intellij-idea.adoc[leveloffset=+1] 14 | 15 | include::command-line-options.adoc[leveloffset=+1] 16 | 17 | include::taint-analysis.adoc[leveloffset=+1] 18 | 19 | include::develop-new-analysis.adoc[leveloffset=+1] 20 | 21 | include::program-abstraction.adoc[leveloffset=+1] 22 | 23 | include::analysis-management.adoc[leveloffset=+1] 24 | 25 | include::pointer-analysis-framework.adoc[leveloffset=+1] 26 | 27 | include::publications.adoc[leveloffset=+1] 28 | -------------------------------------------------------------------------------- /docs/en/index.adoc: -------------------------------------------------------------------------------- 1 | include::attributes.adoc[] 2 | 3 | = Tai-e Reference Documentation 4 | 5 | This documentation is also available as link:index-single.html[a single-page html]. 6 | // and as link:index-single.pdf[a PDF]. 7 | 8 | The reference documentation consists of the following sections: 9 | 10 | * <> 11 | * <> 12 | * <> 13 | * <> 14 | * <> 15 | * <> 16 | * <> 17 | * <> 18 | -------------------------------------------------------------------------------- /gateway_entry_scan/config/__init__.py: -------------------------------------------------------------------------------- 1 | from config.llm import OPENAI_API_KEY, OPENAI_BASE_URL 2 | -------------------------------------------------------------------------------- /gateway_entry_scan/config/llm.py: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY = "" 2 | OPENAI_BASE_URL = "https://api.openai.com/v1" 3 | -------------------------------------------------------------------------------- /gateway_entry_scan/input/example-project.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | cloud: 3 | gateway: 4 | routes: 5 | - id: user_profile 6 | uri: lb://user-service 7 | predicates: 8 | - Path=/user/profile/** 9 | - id: internal_tools 10 | uri: no://blackhole 11 | predicates: 12 | - Path=/internal/tools/** 13 | filters: 14 | - SetStatus=403 15 | - id: public_docs 16 | uri: lb://doc-service 17 | predicates: 18 | - Path=/docs/** 19 | - id: manage_api 20 | uri: lb://manage-service 21 | predicates: 22 | - Path=/manage/** 23 | filters: 24 | - IpWhitelist=192.168.0.0/16 25 | -------------------------------------------------------------------------------- /gateway_entry_scan/model/__init__.py: -------------------------------------------------------------------------------- 1 | from model.model import new_llm -------------------------------------------------------------------------------- /gateway_entry_scan/model/model.py: -------------------------------------------------------------------------------- 1 | from langchain_openai import ChatOpenAI 2 | import config 3 | 4 | 5 | def new_llm(): 6 | llm = ChatOpenAI(api_key=config.OPENAI_API_KEY, base_url=config.OPENAI_BASE_URL, model="gpt-4.1") 7 | return llm -------------------------------------------------------------------------------- /gateway_entry_scan/requirements.txt: -------------------------------------------------------------------------------- 1 | langchain==0.3.20 2 | langchain_openai==0.3.7 -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.caching=true 2 | org.gradle.daemon=true 3 | org.gradle.parallel=true 4 | # project-related properties 5 | projectGroupId=net.pascal-lab 6 | projectArtifactId=tai-e 7 | projectVersion=0.5.1-SNAPSHOT 8 | projectUrl=https://github.com/pascal-lab/Tai-e 9 | projectDescription=An easy-to-learn/use static analysis framework for Java 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /lib/sootclasses-modified.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/lib/sootclasses-modified.jar -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | include( 2 | ":", // root project 3 | "docs", 4 | ) 5 | -------------------------------------------------------------------------------- /src/main/java/fdu/secsys/microservice/entity/Service.java: -------------------------------------------------------------------------------- 1 | /** 2 | * @program: Tai-e-microservice 3 | * @author: LFY 4 | * @create: 2024-03-26 15:56 5 | **/ 6 | 7 | package fdu.secsys.microservice.entity; 8 | 9 | import lombok.Data; 10 | 11 | import java.util.List; 12 | 13 | @Data 14 | public class Service { 15 | 16 | // service name 17 | private String name; 18 | 19 | // service route in gateway 20 | private List route; 21 | 22 | // class list in the service, use for determine the service name of the specific class 23 | private List classList; 24 | 25 | public Service(String name, List route, List classList) { 26 | this.name = name; 27 | this.route = route; 28 | this.classList = classList; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/fdu/secsys/microservice/enums/QueryType.java: -------------------------------------------------------------------------------- 1 | package fdu.secsys.microservice.enums; 2 | 3 | /** 4 | * enum class for sql query type 5 | */ 6 | public enum QueryType { 7 | SELECT("SELECT"), 8 | INSERT("INSERT"), 9 | UPDATE("UPDATE"), 10 | DELETE("DELETE"), 11 | UNKNOWN("UNKNOWN"); 12 | 13 | private final String value; 14 | 15 | QueryType(String value) { 16 | this.value = value; 17 | } 18 | 19 | public String getValue() { 20 | return value; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/fdu/secsys/microservice/util/GatewayUtil.java: -------------------------------------------------------------------------------- 1 | package fdu.secsys.microservice.util; 2 | 3 | import fdu.secsys.microservice.Config; 4 | import fdu.secsys.microservice.entity.Endpoint; 5 | import fdu.secsys.microservice.plugin.GatewaySourcePlugin; 6 | import pascal.taie.language.classes.JMethod; 7 | 8 | import java.util.List; 9 | 10 | public class GatewayUtil { 11 | public static boolean isExposed(JMethod jMethod) { 12 | List endpoints = GatewaySourcePlugin.getEndpoints(); 13 | if (endpoints.isEmpty()) { 14 | return true; 15 | } 16 | return endpoints.stream().anyMatch(endpoint -> endpoint.isExposed() 17 | && endpoint.getClazz().equals(jMethod.getDeclaringClass().getName()) 18 | && endpoint.getMethod().getSignature().equals(jMethod.getSignature())); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/pascal/taie/analysis/pta/plugin/taint/container/spring/InjectFieldInfo.java: -------------------------------------------------------------------------------- 1 | package pascal.taie.analysis.pta.plugin.taint.container.spring; 2 | 3 | public class InjectFieldInfo { 4 | private boolean byType; 5 | private boolean request; 6 | private String qualifier; 7 | 8 | public InjectFieldInfo(boolean byType, boolean request, String qualifier) { 9 | this.byType = byType; 10 | this.request = request; 11 | this.qualifier = qualifier; 12 | } 13 | 14 | public boolean isByType() { 15 | return byType; 16 | } 17 | 18 | public boolean isRequest() { 19 | return request; 20 | } 21 | 22 | public String getQualifier() { 23 | return qualifier; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/pascal/taie/analysis/pta/plugin/taint/container/spring/InjectParamInfo.java: -------------------------------------------------------------------------------- 1 | package pascal.taie.analysis.pta.plugin.taint.container.spring; 2 | 3 | public class InjectParamInfo { 4 | private boolean byType; 5 | private boolean request; 6 | private String qualifier; 7 | private String type; 8 | private int index; 9 | 10 | public InjectParamInfo(boolean byType, boolean request, String qualifier, String type, int index) { 11 | this.byType = byType; 12 | this.request = request; 13 | this.qualifier = qualifier; 14 | this.type = type; 15 | this.index = index; 16 | } 17 | 18 | public boolean isByType() { 19 | return byType; 20 | } 21 | 22 | public boolean isRequest() { 23 | return request; 24 | } 25 | 26 | public String getQualifier() { 27 | return qualifier; 28 | } 29 | 30 | public String getType() { 31 | return type; 32 | } 33 | 34 | public int getIndex() { 35 | return index; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/pascal/taie/analysis/pta/plugin/taint/container/spring/InjectTargetInfo.java: -------------------------------------------------------------------------------- 1 | package pascal.taie.analysis.pta.plugin.taint.container.spring; 2 | 3 | import pascal.taie.language.classes.JClass; 4 | import pascal.taie.language.classes.JField; 5 | 6 | public class InjectTargetInfo { 7 | JField jField; 8 | 9 | JClass jClass; 10 | 11 | public InjectTargetInfo(JClass targetClass, JField targetField) { 12 | this.jClass = targetClass; 13 | this.jField = targetField; 14 | } 15 | 16 | public JField getjField() { 17 | return jField; 18 | } 19 | 20 | public void setjField(JField jField) { 21 | this.jField = jField; 22 | } 23 | 24 | public JClass getjClass() { 25 | return jClass; 26 | } 27 | 28 | public void setjClass(JClass jClass) { 29 | this.jClass = jClass; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/pascal/taie/config/OptionsHolder.java: -------------------------------------------------------------------------------- 1 | package pascal.taie.config; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | public class OptionsHolder { 7 | 8 | public static Options options; 9 | 10 | public static Set cpJars = new HashSet<>(); 11 | 12 | public static Set acpJars = new HashSet<>(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/pascal/taie/ir/exp/IntegerLiteral.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tai-e: A Static Analysis Framework for Java 3 | * 4 | * Copyright (C) 2022 Tian Tan 5 | * Copyright (C) 2022 Yue Li 6 | * 7 | * This file is part of Tai-e. 8 | * 9 | * Tai-e is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License 11 | * as published by the Free Software Foundation, either version 3 12 | * of the License, or (at your option) any later version. 13 | * 14 | * Tai-e is distributed in the hope that it will be useful,but WITHOUT 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 17 | * Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with Tai-e. If not, see . 21 | */ 22 | 23 | package pascal.taie.ir.exp; 24 | 25 | public interface IntegerLiteral extends NumberLiteral { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/pascal/taie/language/type/ReferenceType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Tai-e: A Static Analysis Framework for Java 3 | * 4 | * Copyright (C) 2022 Tian Tan 5 | * Copyright (C) 2022 Yue Li 6 | * 7 | * This file is part of Tai-e. 8 | * 9 | * Tai-e is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public License 11 | * as published by the Free Software Foundation, either version 3 12 | * of the License, or (at your option) any later version. 13 | * 14 | * Tai-e is distributed in the hope that it will be useful,but WITHOUT 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 17 | * Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with Tai-e. If not, see . 21 | */ 22 | 23 | package pascal.taie.language.type; 24 | 25 | public interface ReferenceType extends Type { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/entry/youlai-mall.json: -------------------------------------------------------------------------------- 1 | {"external_entries":["/user/profile/**","/docs/**"],"internal_entries":["/internal/tools/**","/manage/**"]} -------------------------------------------------------------------------------- /src/main/resources/javax.servlet-api-3.1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/main/resources/javax.servlet-api-3.1.0.jar -------------------------------------------------------------------------------- /src/main/resources/log4j2.yml: -------------------------------------------------------------------------------- 1 | Configuration: 2 | status: warn 3 | appenders: 4 | Console: 5 | name: STDOUT 6 | target: SYSTEM_OUT 7 | PatternLayout: 8 | Pattern: "%m%n" 9 | Loggers: 10 | Root: 11 | level: info 12 | AppenderRef: 13 | ref: STDOUT 14 | -------------------------------------------------------------------------------- /src/main/resources/options.yml: -------------------------------------------------------------------------------- 1 | optionsFile: null 2 | printHelp: false 3 | classPath: 4 | - src/main/resources/javax.servlet-api-3.1.0.jar 5 | appClassPath: 6 | mainClass: null 7 | javaVersion: 8 8 | prependJVM: false 9 | allowPhantom: true 10 | worldBuilderClass: pascal.taie.frontend.soot.SootWorldBuilder 11 | outputDir: output 12 | preBuildIR: false 13 | worldCacheMode: false 14 | scope: APP 15 | nativeModel: true 16 | planFile: null 17 | analyses: 18 | pta: taint-config:src/main/resources/taint-config.yml;only-app:true;implicit-entries:false;dump:false;time-limit:1200000;cs:4-call;advanced:pruning;plugins:[fdu.secsys.microservice.plugin.GatewaySourcePlugin,fdu.secsys.microservice.plugin.OpenFeignPlugin,pascal.taie.analysis.pta.plugin.taint.EnhanceTaintAnalysis] 19 | onlyGenPlan: false 20 | keepResult: 21 | - $KEEP-ALL 22 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom1-clone-idiom-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- CloneIdiom1 (clone-idiom) -------------------- 2 | Class: CloneIdiom1, Method: null, LineNumber: null, BugType: CN_IDIOM, Severity: MINOR 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom1.java: -------------------------------------------------------------------------------- 1 | class CloneIdiom1 implements Cloneable { 2 | } 3 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom2-clone-idiom-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- CloneIdiom2 (clone-idiom) -------------------- 2 | Class: CloneIdiom2, Method: null, LineNumber: null, BugType: CN_IDIOM_NO_SUPER_CALL, Severity: MINOR 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom2.java: -------------------------------------------------------------------------------- 1 | public class CloneIdiom2 implements Cloneable { 2 | @Override 3 | public Object clone() { 4 | return new CloneIdiom2(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom3-clone-idiom-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- CloneIdiom3 (clone-idiom) -------------------- 2 | Class: CloneIdiom3, Method: null, LineNumber: null, BugType: CN_IDIOM_NO_SUPER_CALL, Severity: MINOR 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom3.java: -------------------------------------------------------------------------------- 1 | public class CloneIdiom3 implements Cloneable { 2 | @Override 3 | public Object clone() throws CloneNotSupportedException { 4 | return new Object(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom4-clone-idiom-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- CloneIdiom4 (clone-idiom) -------------------- 2 | Class: CloneIdiom4, Method: null, LineNumber: null, BugType: CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE, Severity: MINOR 3 | 4 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/CloneIdiom/CloneIdiom4.java: -------------------------------------------------------------------------------- 1 | public class CloneIdiom4 { 2 | @Override 3 | public Object clone() throws CloneNotSupportedException { 4 | return super.clone(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/bugfinder/NullAnnotation.java: -------------------------------------------------------------------------------- 1 | import javax.annotation.CheckForNull; 2 | import javax.annotation.Nonnull; 3 | import javax.annotation.Nullable; 4 | 5 | public class NullAnnotation { 6 | @Nullable 7 | NullAnnotation getNullable() { 8 | return null; 9 | } 10 | 11 | @CheckForNull 12 | NullAnnotation getCheckForNull() { 13 | return new NullAnnotation(); 14 | } 15 | 16 | @Nonnull 17 | NullAnnotation getNonnull(@CheckForNull Object o) { 18 | return new NullAnnotation(); 19 | } 20 | 21 | void nonNullParameter(@Nonnull Object nonNull) { 22 | 23 | } 24 | 25 | void nullableParameter(@Nullable Object nullable) { 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/cha/AbstractMethod-cg-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (cg) -------------------- 2 | [0@L9] invokespecial %this.()>(); [()>] 3 | 4 | -------------------- (cg) -------------------- 5 | [1@L4] invokespecial temp$0.()>(); [()>] 6 | [3@L5] invokevirtual a.(); [] 7 | 8 | -------------------- ()> (cg) -------------------- 9 | [0@L13] invokespecial %this.()>(); [()>] 10 | 11 | -------------------- (cg) -------------------- 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/cha/AbstractMethod.java: -------------------------------------------------------------------------------- 1 | public class AbstractMethod { 2 | 3 | public static void main(String[] args) { 4 | A a = new B(); 5 | a.foo(); 6 | } 7 | } 8 | 9 | abstract class A { 10 | abstract void foo(); 11 | } 12 | 13 | class B extends A { 14 | void foo() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/cha/CHACP.java: -------------------------------------------------------------------------------- 1 | public class CHACP { 2 | public static void main(String[] args) { 3 | int a, b, c; 4 | CHACP x = new CHACP(); 5 | a = 6; 6 | b = x.addOne(a); 7 | c = b - 3; 8 | b = x.ten(); 9 | c = a * b; 10 | } 11 | 12 | int addOne(int x) { 13 | int y = x + 1; 14 | return y; 15 | } 16 | 17 | int ten() { 18 | return 10; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/cha/InterestingSpecial.java: -------------------------------------------------------------------------------- 1 | public class InterestingSpecial { 2 | 3 | public static void main(String[] args) { 4 | B b = new B(); 5 | b.callInteresting(); 6 | } 7 | } 8 | 9 | class A { 10 | 11 | private void interesting() { 12 | System.out.println("A.interesting()"); 13 | } 14 | 15 | void callInteresting() { 16 | System.out.println(this); 17 | interesting(); // Since Java 11, invokevirtual/invokeinterface 18 | // may be used to call private methods 19 | } 20 | } 21 | 22 | class B extends A { 23 | void interesting() { 24 | System.out.println("B.interesting()"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/cha/Interface-cg-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- (cg) -------------------- 2 | [1@L8] invokespecial temp$0.()>(); [()>] 3 | [3@L9] invokeinterface n.(); [, , ] 4 | 5 | -------------------- ()> (cg) -------------------- 6 | [0@L20] invokespecial %this.()>(); [()>] 7 | 8 | -------------------- (cg) -------------------- 9 | 10 | -------------------- (cg) -------------------- 11 | 12 | -------------------- (cg) -------------------- 13 | 14 | -------------------------------------------------------------------------------- /src/test/resources/cha/Interface.java: -------------------------------------------------------------------------------- 1 | interface Number { 2 | int get(); 3 | } 4 | 5 | public class Interface { 6 | 7 | public static void main(String[] args) { 8 | Number n = new One(); 9 | n.get(); 10 | } 11 | } 12 | 13 | class Zero implements Number { 14 | 15 | public int get() { 16 | return 0; 17 | } 18 | } 19 | 20 | class One implements Number { 21 | 22 | public int get() { 23 | return 1; 24 | } 25 | } 26 | 27 | class Two implements Number { 28 | 29 | public int get() { 30 | return 2; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/cha/Interface2.java: -------------------------------------------------------------------------------- 1 | interface I { 2 | void foo(); 3 | } 4 | 5 | interface II { 6 | void foo(); 7 | 8 | void bar(); 9 | } 10 | 11 | public class Interface2 { 12 | 13 | public static void main(String[] args) { 14 | I i = new A(); 15 | i.foo(); 16 | II ii = new E(); 17 | ii.foo(); 18 | ii.bar(); 19 | } 20 | } 21 | 22 | class A implements I { 23 | public void foo() { 24 | } 25 | } 26 | 27 | class B extends A { 28 | public void foo() { 29 | } 30 | } 31 | 32 | class C extends A { 33 | public void foo() { 34 | } 35 | } 36 | 37 | class D implements I { 38 | public void foo() { 39 | } 40 | } 41 | 42 | class E implements I, II { 43 | public void foo() { 44 | } 45 | 46 | public void bar() { 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/test/resources/cha/Interface3.java: -------------------------------------------------------------------------------- 1 | interface I { 2 | abstract void foo(); 3 | } 4 | 5 | interface II extends I { 6 | abstract void bar(); 7 | } 8 | 9 | interface III extends I { 10 | abstract void bar(); 11 | } 12 | 13 | public class Interface3 { 14 | public static void main(String[] args) { 15 | I i = new D(); 16 | i.foo(); 17 | 18 | II ii = new D(); 19 | ii.foo(); 20 | ii.bar(); 21 | 22 | III iii = new D(); 23 | iii.bar(); 24 | iii.foo(); 25 | 26 | } 27 | } 28 | 29 | 30 | class A implements II { 31 | public void foo() { 32 | } 33 | 34 | public void bar() { 35 | } 36 | } 37 | 38 | class B implements III { 39 | public void foo() { 40 | 41 | } 42 | 43 | public void bar() { 44 | } 45 | } 46 | 47 | class D extends A implements III { 48 | 49 | } -------------------------------------------------------------------------------- /src/test/resources/cha/LongCallChain.java: -------------------------------------------------------------------------------- 1 | public class LongCallChain { 2 | 3 | public static void main(String[] args) { 4 | foo(); 5 | } 6 | 7 | static void foo() { 8 | bar1(); 9 | bar2(); 10 | } 11 | 12 | static void bar1() { 13 | baz1(); 14 | baz2(); 15 | } 16 | 17 | static void bar2() { 18 | } 19 | 20 | static void baz1() { 21 | A a = new A(); 22 | a.m1(); 23 | } 24 | 25 | static void baz2() { 26 | } 27 | } 28 | 29 | class A { 30 | void m1() { 31 | m2(); 32 | } 33 | 34 | void m2() { 35 | m3(); 36 | } 37 | 38 | void m3() { 39 | m4(); 40 | } 41 | 42 | void m4() { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/cha/Recursion.java: -------------------------------------------------------------------------------- 1 | public class Recursion { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | a.foo(); 6 | } 7 | } 8 | 9 | class A { 10 | void foo() { 11 | B b = new B(); 12 | b.bar(); 13 | } 14 | } 15 | 16 | class B { 17 | void bar() { 18 | C c = new C(); 19 | c.baz(); 20 | } 21 | } 22 | 23 | class C { 24 | void baz() { 25 | Recursion.main(null); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/cha/Recursion2-cg-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (cg) -------------------- 2 | [0@L16] invokespecial %this.()>(); [()>] 3 | 4 | -------------------- (cg) -------------------- 5 | [0@L18] invokevirtual %this.(); [] 6 | 7 | -------------------- ()> (cg) -------------------- 8 | [0@L24] invokespecial %this.()>(); [()>] 9 | 10 | -------------------- (cg) -------------------- 11 | [0@L26] invokespecial %this.(); [] 12 | 13 | -------------------- (cg) -------------------- 14 | [0@L30] invokevirtual %this.(); [] 15 | 16 | -------------------- (cg) -------------------- 17 | [1@L11] invokespecial temp$0.()>(); [()>] 18 | [3@L12] invokeinterface i.(); [] 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/cha/Recursion2.java: -------------------------------------------------------------------------------- 1 | interface I { 2 | abstract void foo(); 3 | } 4 | 5 | interface II { 6 | abstract void bar(); 7 | } 8 | 9 | public class Recursion2 { 10 | public static void main(String args[]) { 11 | I i = new B(); 12 | i.foo(); 13 | } 14 | } 15 | 16 | abstract class A implements I { 17 | public void foo() { 18 | goo(); 19 | } 20 | 21 | abstract void goo(); 22 | } 23 | 24 | class B extends A implements II { 25 | public void bar() { 26 | super.foo(); 27 | } 28 | 29 | void goo() { 30 | bar(); 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/resources/cha/SpecialCall.java: -------------------------------------------------------------------------------- 1 | public class SpecialCall { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | B b = new C(); 6 | A a2 = new A(b); 7 | } 8 | } 9 | 10 | class A { 11 | 12 | A() { 13 | } 14 | 15 | A(B b) { 16 | } 17 | 18 | void foo() { 19 | } 20 | } 21 | 22 | class B extends A { 23 | } 24 | 25 | class C extends B { 26 | 27 | C() { 28 | super.foo(); 29 | } 30 | 31 | void foo() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/cha/StaticCall-cg-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- (cg) -------------------- 2 | [0@L18] invokestatic (); [] 3 | 4 | -------------------- (cg) -------------------- 5 | [0@L24] invokestatic (); [] 6 | 7 | -------------------- (cg) -------------------- 8 | [0@L4] invokestatic (); [] 9 | [1@L5] invokestatic (); [] 10 | 11 | -------------------- (cg) -------------------- 12 | [0@L9] invokestatic (); [] 13 | 14 | -------------------- (cg) -------------------- 15 | 16 | -------------------------------------------------------------------------------- /src/test/resources/cha/StaticCall.java: -------------------------------------------------------------------------------- 1 | public class StaticCall { 2 | 3 | public static void main(String[] args) { 4 | foo(); 5 | A.baz(); 6 | } 7 | 8 | static void foo() { 9 | bar(); 10 | } 11 | 12 | static void bar() { 13 | } 14 | } 15 | 16 | class A { 17 | static void baz() { 18 | B.qux(); 19 | } 20 | } 21 | 22 | class B { 23 | static void qux() { 24 | A.baz(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/cha/VirtualCall-cg-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (cg) -------------------- 2 | [0@L9] invokespecial %this.()>(); [()>] 3 | 4 | -------------------- (cg) -------------------- 5 | 6 | -------------------- ()> (cg) -------------------- 7 | [0@L14] invokespecial %this.()>(); [()>] 8 | 9 | -------------------- (cg) -------------------- 10 | 11 | -------------------- (cg) -------------------- 12 | 13 | -------------------- (cg) -------------------- 14 | [1@L4] invokespecial temp$0.()>(); [()>] 15 | [3@L5] invokevirtual b.(); [, , ] 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/cha/VirtualCall.java: -------------------------------------------------------------------------------- 1 | public class VirtualCall { 2 | 3 | public static void main(String[] args) { 4 | B b = new B(); 5 | b.foo(); 6 | } 7 | } 8 | 9 | class A { 10 | void foo() { 11 | } 12 | } 13 | 14 | class B extends A { 15 | } 16 | 17 | class C extends B { 18 | void foo() { 19 | } 20 | } 21 | 22 | class D extends B { 23 | void foo() { 24 | } 25 | } 26 | 27 | class E extends A { 28 | void foo() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/AvailExp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Test case for available expression analysis. 3 | */ 4 | class AvailExp { 5 | 6 | int foo(int a, int b, int c) { 7 | int p = a, q = b, r; 8 | long l; 9 | if (a > 0) { 10 | l = (long) a; 11 | p = a + b; 12 | q = b - c; 13 | r = q; 14 | } else { 15 | l = (long) a; 16 | q = a + b; 17 | r = b - c; 18 | c = r; 19 | } 20 | r = p; 21 | use(a, b, c); 22 | use((int) l, r, q); 23 | return r + q; 24 | } 25 | 26 | void use(int i1, int i2, int i3) { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/ReachDef.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Test case for reaching definition analysis. 3 | */ 4 | class ReachDef { 5 | 6 | int foo(int a, int b, int c) { 7 | int x; 8 | if (a > 0) { 9 | x = a; 10 | } else { 11 | x = b; 12 | } 13 | int y = x; 14 | x = c; 15 | return x; 16 | } 17 | 18 | int loop(int a, int b) { 19 | int c; 20 | while (a > b) { 21 | c = b; 22 | --a; 23 | } 24 | return c; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/Assign-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L4] x = 1; {x=1} 7 | [1@L5] x = 2; {x=2} 8 | [2@L6] x = 3; {x=3} 9 | [3@L7] x = 4; {x=4} 10 | [4@L8] y = x; {x=4, y=4} 11 | [5@L8] return; {x=4, y=4} 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/Assign.java: -------------------------------------------------------------------------------- 1 | class Assign { 2 | 3 | void assign() { 4 | int x = 1, y; 5 | x = 2; 6 | x = 3; 7 | x = 4; 8 | y = x; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/BinaryOp.java: -------------------------------------------------------------------------------- 1 | class BinaryOp { 2 | 3 | void constant1() { 4 | int i0 = 0, i1 = 1, i2 = 2; 5 | int x = 1 + 2; 6 | int y = i0 + 3; 7 | int z = i1 + i2; 8 | } 9 | 10 | void constant2() { 11 | int i1 = 1; 12 | int x = i1 + 10; 13 | int y = x * 5; 14 | int z = y - 12; 15 | } 16 | 17 | void constant3() { 18 | int i5 = 5; 19 | int x = i5 * 77; 20 | int y = x / 6; 21 | int z = y % 5; 22 | } 23 | 24 | void NAC(int p) { 25 | int x = p; 26 | int y = 1 + x; 27 | } 28 | 29 | void undefined() { 30 | int x; 31 | int y = x + 1; 32 | } 33 | 34 | void longExpressions() { 35 | int x = 1, y = 2, z = 3; 36 | int a = x + y * z; 37 | int b = (x - y) * z; 38 | int c = (x - y) / z; 39 | int d = (x + y) % z; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/BranchConstant.java: -------------------------------------------------------------------------------- 1 | class BranchConstant { 2 | 3 | void constant1(boolean b) { 4 | int x = 2; 5 | int y = 2; 6 | int z; 7 | if (b) { 8 | z = x + y; 9 | } else { 10 | z = x * y; 11 | } 12 | int n = z; 13 | } 14 | 15 | void constant2(boolean b) { 16 | int x; 17 | if (b) { 18 | x = 10; 19 | } 20 | int y = x; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/BranchNAC.java: -------------------------------------------------------------------------------- 1 | class BranchNAC { 2 | 3 | void NAC1(boolean b) { 4 | int x; 5 | if (b) { 6 | x = 10; 7 | } else { 8 | x = 20; 9 | } 10 | int y = x; 11 | } 12 | 13 | void NAC2(boolean b, int p) { 14 | int x, undef; 15 | if (b) { 16 | x = undef; 17 | } else { 18 | x = p; 19 | } 20 | int y = x; 21 | } 22 | 23 | void nonDistributivity(boolean b) { 24 | int x, y; 25 | if (b) { 26 | x = 2; 27 | y = 3; 28 | } else { 29 | x = 3; 30 | y = 2; 31 | } 32 | int z = x + y; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/BranchUndef-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L5] %intconst0 = 0; {b=NAC} 7 | [1@L5] if (b == %intconst0) goto 6; {b=NAC} 8 | [2@L5] goto 3; {b=NAC} 9 | [3@L5] nop; {b=NAC} 10 | [4@L6] x = undef; {b=NAC} 11 | [5@L5] goto 8; {b=NAC} 12 | [6@L5] nop; {b=NAC} 13 | [7@L8] x = 10; {b=NAC, x=10} 14 | [8@L8] nop; {b=NAC, x=10} 15 | [9@L10] y = x; {b=NAC, x=10, y=10} 16 | [10@L10] return; {b=NAC, x=10, y=10} 17 | 18 | -------------------- (const-prop) -------------------- 19 | [0@L15] x = undef; {b=NAC} 20 | [1@L16] x = 20; {b=NAC, x=20} 21 | [2@L17] a = x; {a=20, b=NAC, x=20} 22 | [3@L17] return; {a=20, b=NAC, x=20} 23 | 24 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/BranchUndef.java: -------------------------------------------------------------------------------- 1 | class BranchUndef { 2 | 3 | void undefined1(boolean b) { 4 | int x, undef; 5 | if (b) { 6 | x = undef; 7 | } else { 8 | x = 10; 9 | } 10 | int y = x; 11 | } 12 | 13 | void undefined2(boolean b) { 14 | int undef; 15 | int x = undef; 16 | x = 20; 17 | int a = x; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/ComparisonOp.java: -------------------------------------------------------------------------------- 1 | class ComparisonOp { 2 | 3 | int fcmp(float f1, float f2) { 4 | int x; 5 | if (f1 < f2) { 6 | return -1; 7 | } 8 | if (f1 > f2) { 9 | return 1; 10 | } 11 | if (f1 == f2) { 12 | return 0; 13 | } 14 | return 666; 15 | } 16 | 17 | int dcmp(double d1, double d2) { 18 | int x; 19 | if (d1 < d2) { 20 | return -1; 21 | } 22 | if (d1 > d2) { 23 | return 1; 24 | } 25 | if (d1 == d2) { 26 | return 0; 27 | } 28 | return 0; 29 | } 30 | 31 | int acmp(Object o1, Object o2) { 32 | if (o1 == null) { 33 | return 0; 34 | } 35 | if (o1 == o2) { 36 | return 1; 37 | } 38 | if (o1 != o2) { 39 | return -1; 40 | } 41 | return 666; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/ConditionOp.java: -------------------------------------------------------------------------------- 1 | class ConditionOp { 2 | 3 | void intEqNeq() { 4 | int i0 = 0, i1 = 1; 5 | boolean b1 = i0 == i1; 6 | boolean b2 = i0 != i1; 7 | } 8 | 9 | void booleanEqNeq() { 10 | boolean t = true, f = false; 11 | boolean b1 = t == f; 12 | boolean b2 = t != f; 13 | } 14 | 15 | void intGeGt() { 16 | int i0 = 0, i1 = 1; 17 | boolean b1 = i0 >= i1; 18 | boolean b2 = i0 > i1; 19 | } 20 | 21 | void intLeLt() { 22 | int i0 = 0, i1 = 1; 23 | boolean b1 = i0 <= i1; 24 | boolean b2 = i0 < i1; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/DivisionByZero-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L4] zero = 0; {p=NAC, zero=0} 7 | [1@L5] undef1 = p / zero; {p=NAC, zero=0} 8 | [2@L6] undef2 = p % zero; {p=NAC, zero=0} 9 | [3@L6] return; {p=NAC, zero=0} 10 | 11 | -------------------- (const-prop) -------------------- 12 | [0@L10] one = 1; {one=1} 13 | [1@L11] zero = 0; {one=1, zero=0} 14 | [2@L12] undef1 = one / zero; {one=1, zero=0} 15 | [3@L13] undef2 = one % zero; {one=1, zero=0} 16 | [4@L13] return; {one=1, zero=0} 17 | 18 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/DivisionByZero.java: -------------------------------------------------------------------------------- 1 | class DivisionByZero { 2 | 3 | void divideNACByZero(int p) { 4 | int zero = 0; 5 | int undef1 = p / zero; 6 | int undef2 = p % zero; 7 | } 8 | 9 | void divideConstantByZero() { 10 | int one = 1; 11 | int zero = 0; 12 | int undef1 = one / zero; 13 | int undef2 = one % zero; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/EdgeRefine-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L5] %intconst0 = 1; {x=NAC} 7 | [1@L5] if (x == %intconst0) goto 3; {x=NAC} 8 | [2@L5] goto 6; {x=NAC} 9 | [3@L5] nop; {x=1} 10 | [4@L6] y = x + %intconst0; {x=1, y=2} 11 | [5@L5] goto 8; {x=1, y=2} 12 | [6@L5] nop; {x=NAC} 13 | [7@L8] y = 2; {x=NAC, y=2} 14 | [8@L8] nop; {x=NAC, y=2} 15 | [9@L10] return y; {x=NAC, y=2} 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/EdgeRefine.java: -------------------------------------------------------------------------------- 1 | class EdgeRefine { 2 | 3 | int branch(int x) { 4 | int y; 5 | if (x == 1) { 6 | y = x + 1; 7 | } else { 8 | y = 2; 9 | } 10 | return y; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/Interprocedural.java: -------------------------------------------------------------------------------- 1 | class Interprocedural { 2 | 3 | void param(int i, boolean b) { 4 | int x = i; 5 | int y = i + 10; 6 | boolean p = b; 7 | } 8 | 9 | void invoke() { 10 | int x = ten(); 11 | int y = id(10); 12 | } 13 | 14 | int ten() { 15 | return 10; 16 | } 17 | 18 | int id(int x) { 19 | return x; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/LogicalOp.java: -------------------------------------------------------------------------------- 1 | class LogicalOp { 2 | 3 | void logicalOp() { 4 | boolean bTrue = true; 5 | boolean bFalse = false; 6 | boolean b1 = bTrue || bFalse; 7 | boolean b2 = bTrue && bFalse; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/Loop.java: -------------------------------------------------------------------------------- 1 | class Loop { 2 | void whileConstant() { 3 | int a, b = 1, c = 1; 4 | int i = 0; 5 | while (i < 10) { 6 | a = b; 7 | b = c; 8 | c = 1; 9 | ++i; 10 | } 11 | } 12 | 13 | void whileNAC() { 14 | int a, b = 0, c = 0; 15 | int i = 0; 16 | while (i < 10) { 17 | a = b; 18 | b = c; 19 | c = 1; 20 | ++i; 21 | } 22 | } 23 | 24 | void whileUndefinedConstant() { 25 | int a, b, c; 26 | int i = 0; 27 | while (i < 10) { 28 | a = b; 29 | b = c; 30 | c = 1; 31 | ++i; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/MultiplyByZero.java: -------------------------------------------------------------------------------- 1 | class MultiplyByZero { 2 | 3 | void multiplyNACByZero(int p) { 4 | int zero = 0; 5 | int zero1 = zero * p; 6 | int zero2 = p * zero; 7 | } 8 | 9 | void multiplyConstantByZero() { 10 | int one = 1; 11 | int zero = 0; 12 | int zero1 = zero * one; 13 | int zero2 = one * zero; 14 | } 15 | 16 | void multiplyUndefByZero() { 17 | int undef; 18 | int zero = 0; 19 | int undef1 = zero * undef; 20 | int undef2 = undef * zero; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SameVarNames.java: -------------------------------------------------------------------------------- 1 | class SameVarNames { 2 | 3 | void constant1(boolean b) { 4 | if (b) { 5 | int a = 1; 6 | } else { 7 | int a = 2; 8 | } 9 | int a = 3; 10 | } 11 | 12 | void constant2(boolean b) { 13 | int a; 14 | if (b) { 15 | a = 1; 16 | } else { 17 | a = 2; 18 | } 19 | a = 3; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleBinary.java: -------------------------------------------------------------------------------- 1 | class SimpleBinary { 2 | 3 | int arithmetic() { 4 | int x = 1, y = 2; 5 | int z = x + y; 6 | return z; 7 | } 8 | 9 | boolean condition() { 10 | int x = 1, y = 2; 11 | boolean z = x == y; 12 | return z; 13 | } 14 | 15 | int shift() { 16 | int x = 1, y = 2; 17 | int z = x << y; 18 | return z; 19 | } 20 | 21 | int bitwise() { 22 | int x = 1, y = 2; 23 | int z = x | y; 24 | return z; 25 | } 26 | 27 | int nac(int p) { 28 | int x = 1, y = p; 29 | int z = x * y; 30 | return z; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleBoolean-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L4] t = 1; {t=1} 7 | [1@L5] f = 0; {f=0, t=1} 8 | [2@L5] return; {f=0, t=1} 9 | 10 | -------------------- (const-prop) -------------------- 11 | [0@L10] z = 1; {z=1} 12 | [1@L10] return; {z=1} 13 | 14 | -------------------- (const-prop) -------------------- 15 | [0@L14] a = 1; {a=1} 16 | [1@L15] b = a; {a=1, b=1} 17 | [2@L16] c = b; {a=1, b=1, c=1} 18 | [3@L16] return; {a=1, b=1, c=1} 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleBoolean.java: -------------------------------------------------------------------------------- 1 | class SimpleBoolean { 2 | 3 | void constant() { 4 | boolean t = true; 5 | boolean f = false; 6 | } 7 | 8 | void undefined() { 9 | boolean x, y, z; 10 | z = true; 11 | } 12 | 13 | void propagation() { 14 | boolean a = true; 15 | boolean b = a; 16 | boolean c = b; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleBranch-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L5] %intconst0 = 0; {p=NAC} 7 | [1@L5] if (p > %intconst0) goto 3; {p=NAC} 8 | [2@L5] goto 6; {p=NAC} 9 | [3@L5] nop; {p=NAC} 10 | [4@L6] x = 1; {p=NAC, x=1} 11 | [5@L5] goto 8; {p=NAC, x=1} 12 | [6@L5] nop; {p=NAC} 13 | [7@L8] x = 2; {p=NAC, x=2} 14 | [8@L8] nop; {p=NAC, x=NAC} 15 | [9@L10] y = x; {p=NAC, x=NAC, y=NAC} 16 | [10@L10] return; {p=NAC, x=NAC, y=NAC} 17 | 18 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleBranch.java: -------------------------------------------------------------------------------- 1 | class SimpleBranch { 2 | 3 | static void NAC(int p) { 4 | int x; 5 | if (p > 0) { 6 | x = 1; 7 | } else { 8 | x = 2; 9 | } 10 | int y = x; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleChar-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L4] a = 97; {a=97} 7 | [1@L5] x = 120; {a=97, x=120} 8 | [2@L5] return; {a=97, x=120} 9 | 10 | -------------------- (const-prop) -------------------- 11 | [0@L10] z = 122; {z=122} 12 | [1@L10] return; {z=122} 13 | 14 | -------------------- (const-prop) -------------------- 15 | [0@L14] a = 97; {a=97} 16 | [1@L15] b = a; {a=97, b=97} 17 | [2@L16] c = b; {a=97, b=97, c=97} 18 | [3@L16] return; {a=97, b=97, c=97} 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleChar.java: -------------------------------------------------------------------------------- 1 | class SimpleChar { 2 | 3 | void constant() { 4 | char a = 'a'; 5 | char x = 'x'; 6 | } 7 | 8 | void undefined() { 9 | char x, y, z; 10 | z = 'z'; 11 | } 12 | 13 | void propagation() { 14 | char a = 'a'; 15 | char b = a; 16 | char c = b; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleConstant-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (const-prop) -------------------- 6 | [0@L4] x = 1; {x=1} 7 | [1@L5] y = 2; {x=1, y=2} 8 | [2@L6] z = 3; {x=1, y=2, z=3} 9 | [3@L6] return; {x=1, y=2, z=3} 10 | 11 | -------------------- (const-prop) -------------------- 12 | [0@L10] x = 10; {x=10} 13 | [1@L11] y = x; {x=10, y=10} 14 | [2@L12] z = y; {x=10, y=10, z=10} 15 | [3@L12] return; {x=10, y=10, z=10} 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/SimpleConstant.java: -------------------------------------------------------------------------------- 1 | class SimpleConstant { 2 | 3 | static void constant() { 4 | int x = 1; 5 | int y = 2; 6 | int z = 3; 7 | } 8 | 9 | static void propagation() { 10 | int x = 10; 11 | int y = x; 12 | int z = y; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/Array.java: -------------------------------------------------------------------------------- 1 | class Array { 2 | 3 | public static void main(String[] args) { 4 | int[] a1 = {1, 2, 3, 5, 7, 9}; 5 | int x = a1[3]; 6 | int[] a2 = new int[3]; 7 | a2[0] = 666; 8 | a2[1] = 888; 9 | a2[2] = 999; 10 | int y = a2[1]; 11 | int z = a2[2]; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ArrayField.java: -------------------------------------------------------------------------------- 1 | class ArrayField { 2 | 3 | public static void main(String[] args) { 4 | array(); 5 | field(); 6 | } 7 | 8 | int foo; 9 | 10 | static int array() { 11 | int arr[] = {1, 2, 3}; 12 | if (arr[0] > arr[1]) { 13 | return arr[0]; // potential dead code 14 | } else { 15 | return arr[1]; 16 | } 17 | } 18 | 19 | static int field() { 20 | ArrayField bar = new ArrayField(); 21 | bar.foo = 1; 22 | if (bar.foo > 0) { 23 | return 1; 24 | } 25 | return -1; // potential dead code 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ArrayInField.java: -------------------------------------------------------------------------------- 1 | class ArrayInField { 2 | public static void main(String args[]) { 3 | foo(); 4 | goo(); 5 | } 6 | 7 | public static void foo() { 8 | A a1 = new A(); 9 | a1.f = new int[2]; 10 | a1.f[1] = 1; 11 | int r1 = a1.f[1]; 12 | } 13 | 14 | public static void goo() { 15 | A a2 = new A(); 16 | int array[] = new int[2]; 17 | array[0] = 1; 18 | a2.f = array; 19 | int r2 = a2.f[0]; 20 | } 21 | 22 | } 23 | 24 | class A { 25 | int[] f; 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ArrayInter.java: -------------------------------------------------------------------------------- 1 | class ArrayInter { 2 | 3 | public static void main(String[] args) { 4 | int[] a = new int[3]; 5 | set0(a, 123); 6 | set1(a, 666); 7 | set2(a, 987); 8 | int[] b = a; 9 | set2(b, 555); 10 | int x = a[0]; 11 | int y = a[1]; 12 | int z = a[2]; 13 | } 14 | 15 | static void set0(int[] arr, int v) { 16 | arr[0] = v; 17 | } 18 | 19 | static void set1(int[] arr, int v) { 20 | arr[1] = v; 21 | } 22 | 23 | static void set2(int[] arr, int v) { 24 | arr[2] = v; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ArrayInter2-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- (inter-const-prop) -------------------- 2 | [0@L4] %intconst0 = 1; {} 3 | [1@L4] a = newarray int[%intconst0]; {} 4 | [2@L5] %intconst1 = 0; {} 5 | [3@L5] %intconst2 = 777; {} 6 | [4@L5] invokestatic (a, %intconst1, %intconst2); {} 7 | [5@L6] temp$0 = invokestatic (a, %intconst1); {} 8 | [6@L6] x = temp$0; {temp$0=777, x=777} 9 | [7@L6] return; {temp$0=777, x=777} 10 | 11 | -------------------- (inter-const-prop) -------------------- 12 | [0@L10] arr[i] = v; {i=0, v=777} 13 | [1@L10] return; {i=0, v=777} 14 | 15 | -------------------- (inter-const-prop) -------------------- 16 | [0@L13] temp$2 = arr[i]; {i=0, temp$2=777} 17 | [1@L14] return temp$2; {i=0, temp$2=777} 18 | 19 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ArrayInter2.java: -------------------------------------------------------------------------------- 1 | class ArrayInter2 { 2 | 3 | public static void main(String[] args) { 4 | int[] a = new int[1]; 5 | set(a, 0, 777); 6 | int x = get(a, 0); 7 | } 8 | 9 | static void set(int[] arr, int i, int v) { 10 | arr[i] = v; 11 | } 12 | 13 | static int get(int[] arr, int i) { 14 | return arr[i]; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ArrayLoops.java: -------------------------------------------------------------------------------- 1 | class ArrayLoops { 2 | 3 | public static void main(String[] args) { 4 | loopConst(); 5 | loopMix(); 6 | loopNAC(); 7 | } 8 | 9 | static void loopConst() { 10 | int[] a = new int[5]; 11 | for (int i = 0; i < a.length; ++i) { 12 | a[i] = 666; 13 | } 14 | int x = a[3]; 15 | } 16 | 17 | static void loopMix() { 18 | int[] a = new int[5]; 19 | for (int i = 0; i < a.length; ++i) { 20 | a[i] = 666; 21 | } 22 | a[4] = 777; 23 | int x = a[3]; 24 | int y = a[4]; 25 | } 26 | 27 | static void loopNAC() { 28 | int[] a = new int[5]; 29 | for (int i = 0; i < a.length; ++i) { 30 | a[i] = i; 31 | } 32 | int x = a[3]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/InheritedField.java: -------------------------------------------------------------------------------- 1 | class InheritedField { 2 | public static void main(String[] args) { 3 | corner1(); 4 | corner2(); 5 | } 6 | 7 | static void corner1() { 8 | B b = new B(); 9 | b.setSuperF(22); 10 | int x = b.f; 11 | int y = foo(b); 12 | } 13 | 14 | static int foo(A a) { 15 | return a.f; 16 | } 17 | 18 | static void corner2() { 19 | A a = new A(); 20 | a.f = 22; 21 | B b = new B(); 22 | b.f = 33; 23 | bar(a); 24 | int x = b.f; 25 | int y = bar(b); 26 | } 27 | 28 | static int bar(A a) { 29 | return a.f; 30 | } 31 | 32 | 33 | } 34 | 35 | class A { 36 | int f; 37 | } 38 | 39 | class B extends A { 40 | int f; 41 | 42 | void setSuperF(int x) { 43 | super.f = x; 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/InstanceField-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (inter-const-prop) -------------------- 2 | [0@L13] invokespecial %this.()>(); {} 3 | [1@L13] return; {} 4 | 5 | -------------------- (inter-const-prop) -------------------- 6 | [0@L4] temp$0 = new A; {} 7 | [1@L4] invokespecial temp$0.()>(); {} 8 | [2@L4] a1 = temp$0; {} 9 | [3@L5] temp$1 = 111; {temp$1=111} 10 | [4@L5] a1. = temp$1; {temp$1=111} 11 | [5@L6] x = a1.; {temp$1=111, x=111} 12 | [6@L7] temp$2 = new A; {temp$1=111, x=111} 13 | [7@L7] invokespecial temp$2.()>(); {temp$1=111, x=111} 14 | [8@L7] a2 = temp$2; {temp$1=111, x=111} 15 | [9@L8] temp$3 = 222; {temp$1=111, temp$3=222, x=111} 16 | [10@L8] a2. = temp$3; {temp$1=111, temp$3=222, x=111} 17 | [11@L9] y = a2.; {temp$1=111, temp$3=222, x=111, y=222} 18 | [12@L9] return; {temp$1=111, temp$3=222, x=111, y=222} 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/InstanceField.java: -------------------------------------------------------------------------------- 1 | class InstanceField { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | a1.f = 111; 6 | int x = a1.f; 7 | A a2 = new A(); 8 | a2.f = 222; 9 | int y = a2.f; 10 | } 11 | } 12 | 13 | class A { 14 | int f; 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/Interprocedural-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (inter-const-prop) -------------------- 2 | [0@L14] invokespecial %this.()>(); {} 3 | [1@L14] return; {} 4 | 5 | -------------------- (inter-const-prop) -------------------- 6 | [0@L4] temp$0 = new A; {} 7 | [1@L4] invokespecial temp$0.()>(); {} 8 | [2@L4] a = temp$0; {} 9 | [3@L5] temp$1 = 555; {temp$1=555} 10 | [4@L5] a. = temp$1; {temp$1=555} 11 | [5@L6] temp$2 = invokestatic (a); {temp$1=555} 12 | [6@L6] x = temp$2; {temp$1=555, temp$2=555, x=555} 13 | [7@L6] return; {temp$1=555, temp$2=555, x=555} 14 | 15 | -------------------- (inter-const-prop) -------------------- 16 | [0@L9] temp$0 = a.; {temp$0=555} 17 | [1@L10] return temp$0; {temp$0=555} 18 | 19 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/Interprocedural.java: -------------------------------------------------------------------------------- 1 | class Interprocedural { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | a.f = 555; 6 | int x = getF(a); 7 | } 8 | 9 | static int getF(A a) { 10 | return a.f; 11 | } 12 | } 13 | 14 | class A { 15 | int f; 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/Interprocedural2.java: -------------------------------------------------------------------------------- 1 | class Interprocedural2 { 2 | public static void main(String[] args) { 3 | X x = new X(); 4 | x.setF(123); 5 | int a = x.getF(); 6 | Y y = new Y(); 7 | y.setG(789); 8 | int b = y.getG(); 9 | } 10 | 11 | static class X { 12 | int f; 13 | 14 | int getF() { 15 | return f; 16 | } 17 | 18 | void setF(int f) { 19 | this.f = f; 20 | } 21 | } 22 | 23 | static class Y { 24 | int g; 25 | 26 | int getG() { 27 | return g; 28 | } 29 | 30 | void setG(int g) { 31 | this.g = g; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/MultiLoads-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (inter-const-prop) -------------------- 2 | [0@L12] invokespecial %this.()>(); {} 3 | [1@L12] return; {} 4 | 5 | -------------------- (inter-const-prop) -------------------- 6 | [0@L4] temp$0 = new A; {} 7 | [1@L4] invokespecial temp$0.()>(); {} 8 | [2@L4] a = temp$0; {} 9 | [3@L5] temp$1 = 666; {temp$1=666} 10 | [4@L5] a. = temp$1; {temp$1=666} 11 | [5@L6] x = a.; {temp$1=666, x=666} 12 | [6@L7] y = a.; {temp$1=666, x=666, y=666} 13 | [7@L8] z = a.; {temp$1=666, x=666, y=666, z=666} 14 | [8@L8] return; {temp$1=666, x=666, y=666, z=666} 15 | 16 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/MultiLoads.java: -------------------------------------------------------------------------------- 1 | class MultiLoads { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | a.f = 666; 6 | int x = a.f; 7 | int y = a.f; 8 | int z = a.f; 9 | } 10 | } 11 | 12 | class A { 13 | int f; 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/MultiObjs.java: -------------------------------------------------------------------------------- 1 | class MultiObjs { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | a1.f = 2333; 6 | A a2 = new A(); 7 | a2.f = 666; 8 | A a3 = new A(); 9 | a3.f = 666; 10 | A aa = args.length > 0 ? a1 : a2; 11 | A aaa = args.length > 0 ? a2 : a3; 12 | int x = aa.f; 13 | int y = aaa.f; 14 | int z = a1.f; 15 | } 16 | } 17 | 18 | class A { 19 | int f; 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/MultiStores.java: -------------------------------------------------------------------------------- 1 | class MultiStores { 2 | public static void main(String[] args) { 3 | A a = new A(); 4 | if (args.length > 0) { 5 | a.f = 0; 6 | } else { 7 | a.f = 1; 8 | } 9 | int x = a.f; 10 | } 11 | } 12 | 13 | class A { 14 | int f; 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ObjSens.java: -------------------------------------------------------------------------------- 1 | class ObjSens { 2 | 3 | public static void main(String[] args) { 4 | X x1 = new X(); 5 | Y y1 = new Y(); 6 | x1.setY(y1); 7 | 8 | X x2 = new X(); 9 | Y y2 = new Y(); 10 | x2.setY(y2); 11 | 12 | Y yy1 = x1.getY(); 13 | yy1.f = 147; 14 | Y yy2 = x2.getY(); 15 | yy2.f = 258; 16 | int n = yy1.f; 17 | } 18 | } 19 | 20 | class X { 21 | 22 | private Y y; 23 | 24 | void setY(Y y) { 25 | this.y = y; 26 | } 27 | 28 | Y getY() { 29 | return y; 30 | } 31 | } 32 | 33 | class Y { 34 | int f; 35 | } 36 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/ObjSens2.java: -------------------------------------------------------------------------------- 1 | interface Iterator { 2 | Int next(); 3 | } 4 | 5 | class ObjSens2 { 6 | public static void main(String[] args) { 7 | List l1 = new List(); 8 | Int n1 = new Int(); 9 | n1.i = 22; 10 | l1.add(n1); 11 | 12 | List l2 = new List(); 13 | Int n2 = new Int(); 14 | n2.i = 33; 15 | l2.add(n2); 16 | 17 | Iterator i1 = l1.iterator(); 18 | Int n3 = i1.next(); 19 | int x = n3.i; 20 | Iterator i2 = l2.iterator(); 21 | Int n4 = i2.next(); 22 | int y = n4.i; 23 | } 24 | } 25 | 26 | class List { 27 | 28 | Int element; 29 | 30 | void add(Int element) { 31 | this.element = element; 32 | } 33 | 34 | Iterator iterator() { 35 | return new ListIterator(); 36 | } 37 | 38 | class ListIterator implements Iterator { 39 | public Int next() { 40 | return element; 41 | } 42 | } 43 | } 44 | 45 | class Int { 46 | int i; 47 | } 48 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/Reference-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (inter-const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (inter-const-prop) -------------------- 6 | [0@L4] %intconst0 = 1; {} 7 | [1@L4] a = newarray java.lang.Object[%intconst0]; {} 8 | [2@L5] temp$2 = new Reference; {} 9 | [3@L5] invokespecial temp$2.()>(); {} 10 | [4@L5] temp$1 = 0; {temp$1=0} 11 | [5@L5] a[temp$1] = temp$2; {temp$1=0} 12 | [6@L6] temp$4 = 0; {temp$1=0, temp$4=0} 13 | [7@L6] o = a[temp$4]; {temp$1=0, temp$4=0} 14 | [8@L6] return; {temp$1=0, temp$4=0} 15 | 16 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/Reference.java: -------------------------------------------------------------------------------- 1 | class Reference { 2 | 3 | public static void main(String[] args) { 4 | Object[] a = new Object[1]; 5 | a[0] = new Reference(); 6 | Object o = a[0]; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/StaticField-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- (inter-const-prop) -------------------- 2 | [0@L6] temp$0 = 100; {temp$0=100} 3 | [1@L6] = temp$0; {temp$0=100} 4 | [2@L7] x = ; {temp$0=100, x=100} 5 | [3@L7] return; {temp$0=100, x=100} 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/StaticField.java: -------------------------------------------------------------------------------- 1 | class StaticField { 2 | 3 | static int f; 4 | 5 | public static void main(String[] args) { 6 | f = 100; 7 | int x = f; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/alias/StaticFieldMultiStores.java: -------------------------------------------------------------------------------- 1 | class StaticFieldMultiStores { 2 | 3 | static int f; 4 | 5 | static int g; 6 | 7 | public static void main(String[] args) { 8 | storeConst(); 9 | storeNAC(); 10 | int x = f; 11 | int y = g; 12 | } 13 | 14 | static void storeConst() { 15 | if (getNAC() > 0) { 16 | f = 555; 17 | } else { 18 | f = 555; 19 | } 20 | } 21 | 22 | static void storeNAC() { 23 | if (getNAC() > 0) { 24 | g = 666; 25 | } else { 26 | g = 777; 27 | } 28 | } 29 | 30 | static int getNAC() { 31 | int i; 32 | for (i = 0; i < 5; ++i) { 33 | } 34 | return i; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/ArgRet.java: -------------------------------------------------------------------------------- 1 | class ArgRet { 2 | 3 | public static void main(String[] args) { 4 | int n1 = branch(args.length); 5 | int n2 = loop(6); 6 | } 7 | 8 | static int branch(int x) { 9 | int n; 10 | if (x > 0) { 11 | n = 111; 12 | } else { 13 | n = -666; 14 | } 15 | n = id(n); 16 | return n; 17 | } 18 | 19 | static int id(int x) { 20 | return x; 21 | } 22 | 23 | static int loop(int times) { 24 | int n = 2333; 25 | int r = 2334; 26 | for (int i = 0; i < times; ++i) { 27 | n = add1(n); 28 | r = n; 29 | } 30 | return r; 31 | } 32 | 33 | static int add1(int x) { 34 | return x + 1; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/CharArgs-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- (inter-const-prop) -------------------- 2 | [0@L3] temp$0 = (int) x; {temp$0=NAC, x=1, y=2} 3 | [1@L3] temp$1 = (int) y; {temp$0=NAC, temp$1=NAC, x=1, y=2} 4 | [2@L3] temp$2 = temp$0 + temp$1; {temp$0=NAC, temp$1=NAC, temp$2=NAC, x=1, y=2} 5 | [3@L3] temp$3 = (char) temp$2; {temp$0=NAC, temp$1=NAC, temp$2=NAC, temp$3=NAC, x=1, y=2} 6 | [4@L4] return temp$3; {temp$0=NAC, temp$1=NAC, temp$2=NAC, temp$3=NAC, x=1, y=2} 7 | 8 | -------------------- (inter-const-prop) -------------------- 9 | [0@L9] x = 1; {x=1} 10 | [1@L10] y = 2; {x=1, y=2} 11 | [2@L11] temp$0 = invokestatic (x, y); {x=1, y=2} 12 | [3@L11] z = temp$0; {temp$0=NAC, x=1, y=2, z=NAC} 13 | [4@L11] return; {temp$0=NAC, x=1, y=2, z=NAC} 14 | 15 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/CharArgs.java: -------------------------------------------------------------------------------- 1 | public class CharArgs { 2 | 3 | static char foo(char x, char y) { 4 | return (char) (x + y); 5 | } 6 | 7 | 8 | public static void main(String[] args) { 9 | char x = 1; 10 | char y = 2; 11 | char z = foo(x, y); 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/DeadLoop.java: -------------------------------------------------------------------------------- 1 | public class DeadLoop { 2 | 3 | public static void main(String args[]) { 4 | int x = 5; 5 | int y = recursion(x); 6 | int z = whileLoop(x); 7 | } 8 | 9 | public static int recursion(int x) { 10 | x += 1; 11 | recursion(x); 12 | return x; 13 | } 14 | 15 | public static int whileLoop(int x) { 16 | int y = 2; 17 | int z = 1; 18 | while (x > y) { 19 | z += 1; 20 | } 21 | return z; 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/Example-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- (inter-const-prop) -------------------- 2 | [0@L5] a = 6; {a=6} 3 | [1@L6] temp$1 = invokestatic (a); {a=6} 4 | [2@L6] b = temp$1; {a=6, b=7, temp$1=7} 5 | [3@L7] %intconst0 = 3; {a=6, b=7, temp$1=7} 6 | [4@L7] c = b - %intconst0; {a=6, b=7, c=4, temp$1=7} 7 | [5@L8] temp$3 = invokestatic (); {a=6, b=7, c=4, temp$1=7} 8 | [6@L8] b = temp$3; {a=6, b=10, c=4, temp$1=7, temp$3=10} 9 | [7@L9] c = a * b; {a=6, b=10, c=60, temp$1=7, temp$3=10} 10 | [8@L9] return; {a=6, b=10, c=60, temp$1=7, temp$3=10} 11 | 12 | -------------------- (inter-const-prop) -------------------- 13 | [0@L13] %intconst0 = 1; {x=6} 14 | [1@L13] y = x + %intconst0; {x=6, y=7} 15 | [2@L14] return y; {x=6, y=7} 16 | 17 | -------------------- (inter-const-prop) -------------------- 18 | [0@L17] temp$0 = 10; {temp$0=10} 19 | [1@L18] return temp$0; {temp$0=10} 20 | 21 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/Example.java: -------------------------------------------------------------------------------- 1 | class Example { 2 | 3 | static void main(String[] args) { 4 | int a, b, c; 5 | a = 6; 6 | b = addOne(a); 7 | c = b - 3; 8 | b = ten(); 9 | c = a * b; 10 | } 11 | 12 | static int addOne(int x) { 13 | int y = x + 1; 14 | return y; 15 | } 16 | 17 | static int ten() { 18 | return 10; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/Fibonacci.java: -------------------------------------------------------------------------------- 1 | public class Fibonacci { 2 | public static void main(String args[]) { 3 | int n = 5; 4 | int z = 0; 5 | z = getFibonacci(n); 6 | } 7 | 8 | public static int getFibonacci(int n) { 9 | if ((n == 0) || (n == 1)) { 10 | return n; 11 | } else { 12 | return getFibonacci(n - 1) + getFibonacci(n - 2); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/FloatArg-inter-const-prop-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (inter-const-prop) -------------------- 2 | [0@L1] invokespecial %this.()>(); {} 3 | [1@L1] return; {} 4 | 5 | -------------------- (inter-const-prop) -------------------- 6 | [0@L3] temp$0 = (float) i; {i=1} 7 | [1@L3] temp$1 = f * temp$0; {i=1} 8 | [2@L3] temp$2 = (int) temp$1; {i=1, temp$2=NAC} 9 | [3@L4] return temp$2; {i=1, temp$2=NAC} 10 | 11 | -------------------- (inter-const-prop) -------------------- 12 | [0@L8] x = 1; {x=1} 13 | [1@L9] f = 2.0F; {x=1} 14 | [2@L10] temp$0 = new FloatArg; {x=1} 15 | [3@L10] invokespecial temp$0.()>(); {x=1} 16 | [4@L10] invokevirtual temp$0.(x, f); {x=1} 17 | [5@L10] return; {x=1} 18 | 19 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/FloatArg.java: -------------------------------------------------------------------------------- 1 | public class FloatArg { 2 | 3 | int foo(int i, float f) { 4 | return (int) (f * i); 5 | } 6 | 7 | public static void main(String[] args) { 8 | int x = 1; 9 | float f = 2.0f; 10 | new FloatArg().foo(x, f); 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/MultiIntArgs.java: -------------------------------------------------------------------------------- 1 | public class MultiIntArgs { 2 | 3 | static int goo(int x, int y) { 4 | return (x + y); 5 | } 6 | 7 | static int foo(int x, int y) { 8 | return (x * y); 9 | } 10 | 11 | public static void main(String[] args) { 12 | //call goo once 13 | int a = 2; 14 | int b = 3; 15 | int c = goo(a, b); 16 | 17 | //call foo twice with different args 18 | int x = 2; 19 | int y = 3; 20 | int z = foo(x, y); 21 | 22 | int r = 4; 23 | int s = 5; 24 | int t = foo(r, s); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/MultiReturn.java: -------------------------------------------------------------------------------- 1 | public class MultiReturn { 2 | boolean retDiffConst(int x) { 3 | if (x % 2 == 0) 4 | return true; 5 | return false; 6 | } 7 | 8 | double retDouble(int x) { 9 | if (x % 2 == 0) 10 | return 1.0; 11 | return 0.0; 12 | } 13 | 14 | int retX(int x) { 15 | if (x % 2 == 0) 16 | return 1; 17 | return x; 18 | } 19 | 20 | int retUndef(int y) { 21 | if (y % 2 == 0) 22 | return 1; 23 | return y; 24 | } 25 | 26 | public static void main(String[] args) { 27 | MultiReturn mr = new MultiReturn(); 28 | int x = 0; 29 | mr.retDiffConst(x); 30 | mr.retDouble(x); 31 | x = 1; 32 | mr.retX(x); 33 | int y; 34 | mr.retUndef(y); 35 | } 36 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/PlusPlus.java: -------------------------------------------------------------------------------- 1 | class PlusPlus { 2 | public static void main(String[] args) { 3 | test1(0, 1); 4 | test2(1, 0); 5 | } 6 | 7 | static void test1(int x, int y) { 8 | x = 1; 9 | ++x; 10 | y = ++x; 11 | } 12 | 13 | static void test2(int x, int y) { 14 | x = 1; 15 | ++x; 16 | x++; 17 | y = ++x; 18 | y = x++; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/constprop/inter/Reference.java: -------------------------------------------------------------------------------- 1 | public class Reference { 2 | public static void main(String args[]) { 3 | Point p = new Point(); 4 | p.x = 2; 5 | p.y = 3; 6 | int offset = 1; 7 | Point p2 = adjustPoint(p, offset); 8 | int z = p2.x + p2.y; 9 | } 10 | 11 | public static Point adjustPoint(Point p, int offset) { 12 | p.x += offset; 13 | p.y += offset; 14 | return p; 15 | } 16 | } 17 | 18 | class Point { 19 | public int x; 20 | public int y; 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/AnonInner.java: -------------------------------------------------------------------------------- 1 | interface Adder { 2 | int add(int j); 3 | } 4 | 5 | class AnonInner { 6 | 7 | static Adder makeAdder(final int i) { 8 | return new Adder() { 9 | @Override 10 | public int add(int j) { 11 | return i + j; 12 | } 13 | }; 14 | } 15 | 16 | static void show() { 17 | System.out.println(makeAdder(2).add(5)); 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Array-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L4] result = 0; [arr, result] 7 | [1@L5] i = 0; [arr, i, result] 8 | [2@L5] nop; [arr, i, result] 9 | [3@L5] temp$0 = arr.length; [arr, i, result, temp$0] 10 | [4@L5] if (i < temp$0) goto 6; [arr, i, result] 11 | [5@L5] goto 13; [result] 12 | [6@L5] nop; [arr, i, result] 13 | [7@L6] temp$4 = arr[i]; [arr, i, result, temp$4] 14 | [8@L6] result = result + temp$4; [arr, i, result] 15 | [9@L6] nop; [arr, i, result] 16 | [10@L5] %intconst0 = 1; [%intconst0, arr, i, result] 17 | [11@L5] i = i + %intconst0; [arr, i, result] 18 | [12@L5] goto 2; [arr, i, result] 19 | [13@L5] nop; [result] 20 | [14@L8] return result; [] 21 | 22 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Array.java: -------------------------------------------------------------------------------- 1 | class Array { 2 | 3 | int sum(int arr[]) { 4 | int result = 0; 5 | for (int i = 0; i < arr.length; i++) { 6 | result += arr[i]; 7 | } 8 | return result; 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Assign-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L4] d = a + b; [a, d] 7 | [1@L5] b = d; [a, b] 8 | [2@L6] c = a; [b] 9 | [3@L7] return b; [] 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Assign.java: -------------------------------------------------------------------------------- 1 | class Assign { 2 | 3 | int assign(int a, int b, int c) { 4 | int d = a + b; 5 | b = d; 6 | c = a; 7 | return b; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Branch-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L4] x = m; [k, n, x] 7 | [1@L5] %intconst0 = 0; [%intconst0, k, n, x] 8 | [2@L5] if (n > %intconst0) goto 4; [k, n, x] 9 | [3@L5] goto 7; [k, n] 10 | [4@L5] nop; [n, x] 11 | [5@L5] temp$1 = x + n; [temp$1] 12 | [6@L6] return temp$1; [] 13 | [7@L6] nop; [k, n] 14 | [8@L6] temp$3 = k + n; [temp$3] 15 | [9@L8] return temp$3; [] 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Branch.java: -------------------------------------------------------------------------------- 1 | class Branch { 2 | 3 | int ifElse(int m, int n, int k) { 4 | int x = m; 5 | if (n > 0) { 6 | return x + n; 7 | } else { 8 | return k + n; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/BranchLoop.java: -------------------------------------------------------------------------------- 1 | class BranchLoop { 2 | 3 | int loopBranch(int m, int n, int k) { 4 | int a, i; 5 | for (i = m - 1; i < k; i++) { 6 | if (i >= n) { 7 | a = n; 8 | } 9 | a = a + i; 10 | } 11 | return a; 12 | } 13 | 14 | void branchLoop(int c, boolean d) { 15 | int x, y, z; 16 | x = 1; 17 | y = 2; 18 | if (c > 0) { 19 | do { 20 | x = y + 1; 21 | y = 2 * z; 22 | if (d) { 23 | x = y + z; 24 | } 25 | z = 1; 26 | } while (c < 20); 27 | } 28 | z = x; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/ComplexAssign-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L4] x = 1; [] 7 | [1@L5] x = 2; [x] 8 | [2@L6] a = x; [a, x] 9 | [3@L7] %intconst0 = 1; [%intconst0, a, x] 10 | [4@L7] a = a - %intconst0; [%intconst0, a, x] 11 | [5@L8] x = x - %intconst0; [%intconst0, a] 12 | [6@L9] x = 2; [%intconst0, a, x] 13 | [7@L10] b = a; [%intconst0, b, x] 14 | [8@L11] b = b - %intconst0; [x] 15 | [9@L12] %intconst1 = 2; [%intconst1, x] 16 | [10@L12] b = x - %intconst1; [b] 17 | [11@L13] return b; [] 18 | 19 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/ComplexAssign.java: -------------------------------------------------------------------------------- 1 | class ComplexAssign { 2 | 3 | int complexAssign(int a, int b) { 4 | int x = 1; 5 | x = 2; 6 | a = x; 7 | a = a - 1; 8 | x = x - 1; 9 | x = 2; 10 | b = a; 11 | b = b - 1; 12 | b = x - 2; 13 | return b; 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Corner-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L2] temp$0 = 1; [temp$0] 7 | [1@L3] return temp$0; [] 8 | 9 | -------------------- (live-var) -------------------- 10 | [0@L7] a = 1; [] 11 | [1@L7] return; [] 12 | 13 | -------------------- (live-var) -------------------- 14 | [0@L10] return; [] 15 | 16 | -------------------- (live-var) -------------------- 17 | [0@L15] a = 1; [a] 18 | [1@L15] nop; [a] 19 | [2@L16] goto 3; [a] 20 | [3@L16] nop; [a] 21 | [4@L17] %intconst0 = 1; [%intconst0, a] 22 | [5@L17] a = a + %intconst0; [a] 23 | [6@L16] goto 1; [a] 24 | [7@L19] return a; [] 25 | 26 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Corner.java: -------------------------------------------------------------------------------- 1 | class Corner { 2 | int exit() { 3 | return 1; 4 | } 5 | 6 | void exit2() { 7 | int a = 1; 8 | } 9 | 10 | void exit3() { 11 | ; 12 | } 13 | 14 | int deadLoop() { 15 | int a = 1; 16 | while (true) { 17 | a += 1; 18 | } 19 | return a; 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Fibonacci.java: -------------------------------------------------------------------------------- 1 | class Fibonacci { 2 | int getFibonacci(int n) { 3 | if ((n == 0) || (n == 1)) { 4 | return n; 5 | } else { 6 | return getFibonacci(n - 1) + getFibonacci(n - 2); 7 | } 8 | } 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Field.java: -------------------------------------------------------------------------------- 1 | class Field { 2 | public String name; 3 | public int age; 4 | 5 | int timeFlies(int years) { 6 | age += years; 7 | System.out.println(name + "is " + years + " years older."); 8 | return age; 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Invoke-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L4] x = a - b; [%this, a, x] 7 | [1@L5] y = a - x; [%this, x] 8 | [2@L6] z = x; [%this, z] 9 | [3@L7] %intconst0 = 0; [%intconst0, %this, z] 10 | [4@L7] invokevirtual %this.(%intconst0, %intconst0, %intconst0); [z] 11 | [5@L8] return z; [] 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Invoke.java: -------------------------------------------------------------------------------- 1 | class Invoke { 2 | 3 | int invoke(int a, int b, int c) { 4 | int x = a - b; 5 | int y = a - x; 6 | int z = x; 7 | invoke(0, 0, 0); 8 | return z; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Loop-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L4] y = 0; [x, y] 7 | [1@L5] i = 0; [i, x, y] 8 | [2@L5] nop; [i, x, y] 9 | [3@L5] if (i < x) goto 5; [i, x, y] 10 | [4@L5] goto 12; [y] 11 | [5@L5] nop; [i, x, y] 12 | [6@L6] %intconst0 = 20; [%intconst0, i, x, y] 13 | [7@L6] y = y + %intconst0; [i, x, y] 14 | [8@L6] nop; [i, x, y] 15 | [9@L5] %intconst1 = 1; [%intconst1, i, x, y] 16 | [10@L5] i = i + %intconst1; [i, x, y] 17 | [11@L5] goto 2; [i, x, y] 18 | [12@L5] nop; [y] 19 | [13@L8] return y; [] 20 | 21 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Loop.java: -------------------------------------------------------------------------------- 1 | class Loop { 2 | 3 | int loop(int x) { 4 | int y = 0; 5 | for (int i = 0; i < x; ++i) { 6 | y += 20; 7 | } 8 | return y; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/Reference.java: -------------------------------------------------------------------------------- 1 | class A { 2 | C c; 3 | 4 | A() { 5 | this.c = null; 6 | } 7 | 8 | void setC(C c) { 9 | this.c = c; 10 | } 11 | } 12 | 13 | class B extends A { 14 | B() { 15 | super(); 16 | } 17 | } 18 | 19 | class C { 20 | } 21 | 22 | class Reference { 23 | A referenceType(C c) { 24 | B b = new B(); 25 | b.setC(c); 26 | return b; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/StronglyAssign-live-var-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (live-var) -------------------- 2 | [0@L1] invokespecial %this.()>(); [] 3 | [1@L1] return; [] 4 | 5 | -------------------- (live-var) -------------------- 6 | [0@L4] d = a + b; [d] 7 | [1@L5] b = d; [b] 8 | [2@L6] c = a; [b] 9 | [3@L7] return b; [] 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/StronglyAssign.java: -------------------------------------------------------------------------------- 1 | class StronglyAssign { 2 | 3 | int assign(int a, int b, int c) { 4 | int d = a + b; 5 | b = d; 6 | c = a; 7 | return b; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/dataflow/livevar/StronglyBranchLoop.java: -------------------------------------------------------------------------------- 1 | class StronglyBranchLoop { 2 | 3 | int loopBranch(int m, int n, int k) { 4 | int a, i; 5 | for (i = m - 1; i < k; i++) { 6 | if (i >= n) { 7 | a = n; 8 | } 9 | a = a + i; 10 | } 11 | return a; 12 | } 13 | 14 | void branchLoop(int c, boolean d) { 15 | int x, y, z; 16 | x = 1; 17 | y = 2; 18 | if (c > 0) { 19 | do { 20 | x = y + 1; 21 | y = 2 * z; 22 | if (d) { 23 | x = y + z; 24 | } 25 | z = 1; 26 | } while (c < 20); 27 | } 28 | z = x; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/AllReachableIfBranch-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [0@L3] z = x + y; 5 | 6 | -------------------- (dead-code) -------------------- 7 | [0@L13] z = x + y; 8 | [7@L17] z = 100; 9 | 10 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/AllReachableIfBranch.java: -------------------------------------------------------------------------------- 1 | class AllReachableIfBranch { 2 | int branch(int x, int y) { 3 | int z = x + y;//dead 4 | if (x > y) { 5 | z = 100; 6 | } else { 7 | z = 200; 8 | } 9 | return z; 10 | } 11 | 12 | int branch2(int x, int y) { 13 | int z = x + y;//dead 14 | int a = x - y; 15 | if (x > y) { 16 | a = a + 1; 17 | z = 100;//dead 18 | } 19 | z = 2 + a; 20 | return z; 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /src/test/resources/deadcode/ArrayField-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | 5 | -------------------- (dead-code) -------------------- 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/ArrayField.java: -------------------------------------------------------------------------------- 1 | class ArrayField { 2 | 3 | int foo; 4 | 5 | int array() { 6 | int arr[] = {1, 2, 3}; 7 | if (arr[0] > arr[1]) { 8 | return arr[0]; // potential dead code 9 | } else { 10 | return arr[1]; 11 | } 12 | } 13 | 14 | int field() { 15 | ArrayField bar = new ArrayField(); 16 | bar.foo = 1; 17 | if (bar.foo > 0) { 18 | return 1; 19 | } 20 | bar.foo = 2; // potential dead code 21 | return -1; // potential dead code 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/ControlFlowUnreachable-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [2@L6] invokestatic (); 5 | 6 | -------------------- (dead-code) -------------------- 7 | 8 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/ControlFlowUnreachable.java: -------------------------------------------------------------------------------- 1 | public class ControlFlowUnreachable { 2 | 3 | static int foo() { 4 | int x = 1; 5 | return x; 6 | dead(); // unreachable 7 | } 8 | 9 | static void dead() { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/ControlFlowUnreachable2-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [5@L9] z = 3; 5 | [6@L10] invokestatic (z); 6 | [7@L10] return; 7 | 8 | -------------------- (dead-code) -------------------- 9 | 10 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/ControlFlowUnreachable2.java: -------------------------------------------------------------------------------- 1 | public class ControlFlowUnreachable2 { 2 | 3 | static void foo() { 4 | int x = 1; 5 | int y = 2; 6 | use(x); 7 | use(y); 8 | return; 9 | int z = 3; // unreachable 10 | use(z); // unreachable 11 | } 12 | 13 | static void use(int x) { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/Corner-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [0@L3] x = 1; 5 | [3@L5] x = temp$0; 6 | 7 | -------------------- (dead-code) -------------------- 8 | 9 | -------------------- (dead-code) -------------------- 10 | 11 | -------------------- (dead-code) -------------------- 12 | [0@L20] x = 1; 13 | [3@L22] x = temp$0; 14 | 15 | -------------------- (dead-code) -------------------- 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/Corner.java: -------------------------------------------------------------------------------- 1 | class Corner { 2 | int sideEffectAssignment() { 3 | int x = 1; 4 | long y = 2; 5 | x = (int) y; 6 | return 5; 7 | } 8 | 9 | void sideEffectMod() { 10 | int x = 0; 11 | int y = 1 % x; 12 | } 13 | 14 | void sideEffectDivide() { 15 | int x = 0; 16 | int y = 1 / x; 17 | } 18 | 19 | int invoke() { 20 | int x = 1; 21 | int y = 2; 22 | x = foo(y); 23 | return 5; 24 | } 25 | 26 | int foo(int x) { 27 | x = 2; 28 | return x; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/DeadAssignment-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [2@L5] y = x + %intconst0; 5 | [6@L8] a = x; 6 | 7 | -------------------- (dead-code) -------------------- 8 | 9 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/DeadAssignment.java: -------------------------------------------------------------------------------- 1 | class DeadAssignment { 2 | 3 | void deadAssign() { 4 | int x = 1; 5 | int y = x + 2; // dead assignment 6 | int z = x + 3; 7 | use(z); 8 | int a = x; // dead assignment 9 | } 10 | 11 | void use(int n) { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/DeadAssignment2-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | 5 | -------------------- (dead-code) -------------------- 6 | [2@L7] o = temp$0; 7 | [4@L8] b = temp$1; 8 | 9 | -------------------- (dead-code) -------------------- 10 | [2@L13] y = x + %intconst0; 11 | [6@L16] a = x; 12 | 13 | -------------------- (dead-code) -------------------- 14 | [4@L23] y = 10; 15 | [9@L27] y = 200; 16 | 17 | -------------------- (dead-code) -------------------- 18 | [0@L33] x = 0; 19 | [1@L34] x = 1; 20 | 21 | -------------------- (dead-code) -------------------- 22 | 23 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/DeadAssignment2.java: -------------------------------------------------------------------------------- 1 | class DeadAssignment2 { 2 | 3 | static void use(int x) { 4 | } 5 | 6 | void deadAssign1() { 7 | Object o = new Object(); 8 | int b = ten(); 9 | } 10 | 11 | void deadAssign2() { 12 | int x = 1; 13 | int y = x + 2; // dead assignment 14 | int z = x + 3; 15 | use(z); 16 | int a = x; // dead assignment 17 | } 18 | 19 | void deadAssign3(int p, int q) { 20 | int x, y; 21 | if (p > q) { 22 | x = 1; 23 | y = 10; // dead assignment 24 | } else { 25 | x = 0; 26 | } 27 | y = 200; // dead assignment 28 | use(x); 29 | } 30 | 31 | int deadAssign4() { 32 | int x; 33 | x = 0; // dead assignment 34 | x = 1; // dead assignment 35 | x = 2; 36 | return x; 37 | } 38 | 39 | int ten() { 40 | return 10; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/ForLoops-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [6@L6] nop; 5 | [7@L7] invokevirtual %this.(y); 6 | [8@L8] return; 7 | [9@L8] nop; 8 | [10@L6] %intconst0 = 1; 9 | [11@L6] i = i + %intconst0; 10 | [12@L6] goto 3; 11 | 12 | -------------------- (dead-code) -------------------- 13 | [5@L16] goto 13; 14 | [9@L18] nop; 15 | [10@L16] %intconst0 = 1; 16 | [11@L16] i = i + %intconst0; 17 | [12@L16] goto 3; 18 | [13@L16] nop; 19 | [14@L20] invokevirtual %this.(y); 20 | [15@L20] return; 21 | 22 | -------------------- (dead-code) -------------------- 23 | 24 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/ForLoops.java: -------------------------------------------------------------------------------- 1 | class ForLoops { 2 | 3 | void dead1() { 4 | int m = 0; 5 | int y = 2; 6 | for (int i = 0; i < m; ++i) { 7 | use(y); 8 | return; 9 | } 10 | use(y) 11 | } 12 | 13 | void dead2() { 14 | int m = 0; 15 | int y = 2; 16 | for (int i = 0; i >= m; ++i) { 17 | use(y); 18 | return; 19 | } 20 | use(y) 21 | } 22 | 23 | void use(int x) { 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/deadcode/LiveAssignments-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | 5 | -------------------- ()> (dead-code) -------------------- 6 | 7 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/LiveAssignments.java: -------------------------------------------------------------------------------- 1 | class LiveAssignments { 2 | 3 | void foo(int[] arr, C c) { 4 | int i = 0; 5 | arr[i] = 111; 6 | c.f = 222; 7 | } 8 | 9 | static class C { 10 | int f; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/Loops-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [5@L7] goto 9; 5 | [9@L7] nop; 6 | [10@L10] invokevirtual %this.(); 7 | [11@L10] return; 8 | 9 | -------------------- (dead-code) -------------------- 10 | 11 | -------------------- (dead-code) -------------------- 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/Loops.java: -------------------------------------------------------------------------------- 1 | class Loops { 2 | 3 | void deadLoop() { 4 | int x = 1; 5 | int y = 0; 6 | int z = 100; 7 | while (x > y) { 8 | use(z); 9 | } 10 | dead(); // unreachable branch 11 | } 12 | 13 | void dead() { 14 | } 15 | 16 | void use(int n) { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/MixedDeadCode-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [0@L4] x = 1; 5 | [1@L5] y = 2; 6 | [3@L7] z = 3; 7 | [4@L7] return; 8 | 9 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/MixedDeadCode.java: -------------------------------------------------------------------------------- 1 | class MixedDeadCode { 2 | 3 | void foo() { 4 | int x = 1; // dead assignment 5 | int y = 2; // dead assignment 6 | return; 7 | int z = 3; // unreachable 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/NotDead-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | 5 | -------------------- (dead-code) -------------------- 6 | 7 | -------------------- (dead-code) -------------------- 8 | 9 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/NotDead.java: -------------------------------------------------------------------------------- 1 | class NotDead { 2 | 3 | void foo(int x, int y) { 4 | int a; 5 | if (x > y) { 6 | a = 0; 7 | } else { 8 | a = 1; 9 | } 10 | use(a); 11 | } 12 | 13 | int bar() { 14 | int x = 1; 15 | int y = x; 16 | int z = y; 17 | return z; 18 | } 19 | 20 | void use(int n) { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/UnreachableIfBranch-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [3@L7] goto 7; 5 | [7@L7] nop; 6 | [8@L10] z = 200; 7 | 8 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/UnreachableIfBranch.java: -------------------------------------------------------------------------------- 1 | class UnreachableIfBranch { 2 | 3 | int branch() { 4 | int x = 10; 5 | int y = 1; 6 | int z; 7 | if (x > y) { 8 | z = 100; 9 | } else { 10 | z = 200; // unreachable branch 11 | } 12 | return z; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/UnreachableIfBranch2-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [3@L7] goto 8; 5 | [8@L10] nop; 6 | [9@L12] z = 200; 7 | [10@L14] a = x; 8 | [11@L15] invokevirtual %this.(a); 9 | [12@L16] invokevirtual %this.(z); 10 | [13@L16] return; 11 | 12 | -------------------- (dead-code) -------------------- 13 | 14 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/UnreachableIfBranch2.java: -------------------------------------------------------------------------------- 1 | class UnreachableIfBranch2 { 2 | 3 | void branch() { 4 | int x = 10; 5 | int y = 1; 6 | int z; 7 | if (x > y) { 8 | z = 100; 9 | use(z); 10 | return; 11 | } else { 12 | z = 200; // unreachable 13 | } 14 | int a = x; // unreachable 15 | use(a); // unreachable 16 | use(z); // unreachable 17 | } 18 | 19 | void use(int x) { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/UnreachableSwitchBranch-dead-code-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (dead-code) -------------------- 2 | 3 | -------------------- (dead-code) -------------------- 4 | [4@L6] nop; 5 | [5@L8] %intconst1 = 2; 6 | [6@L8] invokevirtual %this.(%intconst1); 7 | [7@L9] goto 24; 8 | [8@L9] nop; 9 | [9@L11] %intconst2 = 4; 10 | [10@L11] invokevirtual %this.(%intconst2); 11 | [11@L12] goto 24; 12 | [16@L15] nop; 13 | [17@L17] %intconst4 = 666; 14 | [18@L17] invokevirtual %this.(%intconst4); 15 | [19@L18] goto 24; 16 | [20@L6] goto 24; 17 | 18 | -------------------- (dead-code) -------------------- 19 | 20 | -------------------------------------------------------------------------------- /src/test/resources/deadcode/UnreachableSwitchBranch.java: -------------------------------------------------------------------------------- 1 | class UnreachableSwitchBranch { 2 | 3 | void lookupSwitch() { 4 | int x = 1; 5 | int y = x << 3; 6 | switch (y) { 7 | case 2: 8 | use(2); 9 | break; // unreachable case 10 | case 4: 11 | use(4); 12 | break; // unreachable case 13 | case 8: 14 | use(8); 15 | break; 16 | default: 17 | use(666); 18 | break; // unreachable case 19 | } 20 | } 21 | 22 | void use(int x) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/defuse/DefUse.java: -------------------------------------------------------------------------------- 1 | class DefUse { 2 | 3 | int assign() { 4 | int x = 1; 5 | int y = x + 111; 6 | x = 2; 7 | int z = x + y; 8 | return z; 9 | } 10 | 11 | int branch(int a, int b, int c) { 12 | int x; 13 | if (a > 0) { 14 | x = a; 15 | } else { 16 | x = b; 17 | } 18 | int y = x; 19 | x = c; 20 | return x; 21 | } 22 | 23 | int loop(int a, int b) { 24 | int c; 25 | while (a > b) { 26 | c = b; 27 | --a; 28 | } 29 | return c; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Array.java: -------------------------------------------------------------------------------- 1 | class Array { 2 | 3 | public static void main(String[] args) { 4 | A[] arr = new A[10]; 5 | arr[0] = new A(); 6 | arr[1] = new A(); 7 | A a = arr[0]; 8 | arr.hashCode(); 9 | B[] barr = new B[10]; 10 | arrayStore(barr, new A()); 11 | Object o = barr[0]; 12 | } 13 | 14 | private static void arrayStore(Object[] a, Object o) { 15 | a[0] = o; 16 | } 17 | } 18 | 19 | class A { 20 | } 21 | 22 | class B { 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Assign.java: -------------------------------------------------------------------------------- 1 | public class Assign { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | A a2 = a1; 6 | A a3 = a1; 7 | B b = new B(); 8 | a1 = b; 9 | } 10 | } 11 | 12 | class A { 13 | } 14 | 15 | class B extends A { 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Assign2.java: -------------------------------------------------------------------------------- 1 | class Assign2 { 2 | public static void main(String[] args) { 3 | new A().cycle(); 4 | } 5 | } 6 | 7 | class A { 8 | 9 | void cycle() { 10 | A a1 = new A(); 11 | A a2 = new A(); 12 | A a3 = new A(); 13 | a1 = a2; 14 | a2 = a3; 15 | a3 = a1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Call.java: -------------------------------------------------------------------------------- 1 | public class Call { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | B b = new B(); 6 | C c = new C(); 7 | C x = a.foo(b, c); 8 | } 9 | } 10 | 11 | class A { 12 | 13 | C foo(B b, C c) { 14 | return c; 15 | } 16 | } 17 | 18 | class B { 19 | } 20 | 21 | class C { 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/CallField.java: -------------------------------------------------------------------------------- 1 | class CallField { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | a.setget(); 6 | a.modifyParam(); 7 | } 8 | 9 | } 10 | 11 | class A { 12 | 13 | void setget() { 14 | B b = new B(); 15 | b.set(new C()); 16 | C c = b.get(); 17 | } 18 | 19 | void modifyParam() { 20 | B b1 = new B(); 21 | B b2 = new B(); 22 | b1.setC(b2); 23 | C c = b2.c; 24 | } 25 | } 26 | 27 | class B { 28 | 29 | C c; 30 | 31 | void set(C c) { 32 | this.c = c; 33 | } 34 | 35 | C get() { 36 | return c; 37 | } 38 | 39 | void setC(B b) { 40 | b.c = new C(); 41 | } 42 | } 43 | 44 | class C { 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/CallParamRet.java: -------------------------------------------------------------------------------- 1 | class CallParamRet { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | a.param(); 6 | B b = a.id(new B()); 7 | } 8 | 9 | } 10 | 11 | class A { 12 | 13 | void param() { 14 | B b1 = new B(); 15 | B b2 = new B(); 16 | foo(b1, b2); 17 | bar(b2, b1); 18 | } 19 | 20 | void foo(B p1, B p2) { 21 | } 22 | 23 | void bar(B p1, B p2) { 24 | } 25 | 26 | B id(B b) { 27 | return b; 28 | } 29 | } 30 | 31 | class B { 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Cast.java: -------------------------------------------------------------------------------- 1 | class Cast { 2 | public static void main(String[] args) { 3 | m(); 4 | } 5 | 6 | static void m() { 7 | Object o = new A(); 8 | o = new B(); 9 | o = new C(); 10 | A a = (A) o; 11 | B b = (B) o; 12 | C c = (C) o; 13 | } 14 | } 15 | 16 | class A { 17 | } 18 | 19 | class B { 20 | } 21 | 22 | class C extends B { 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Cast2.java: -------------------------------------------------------------------------------- 1 | class Cast2{ 2 | public static void main(String[] args) { 3 | m(); 4 | } 5 | 6 | static void m() { 7 | Animal animal = new Animal(); 8 | animal = new Dog(); 9 | animal = new Cat(); 10 | animal = new Pupi(); //may-fail 11 | 12 | Dog dog = (Dog) animal; 13 | 14 | Dog dog2 = new Dog(); 15 | Pupi pupi = (Pupi) dog2; //fail 16 | 17 | Animal animal2 = new Dog(); 18 | Dog dog4 = (Dog) animal2; //safe 19 | 20 | Dog dog5 = new Pupi(); 21 | Animal animal3 = dog5; 22 | Pupi pupi1 = (Pupi) animal3; //safe 23 | 24 | Animal animal4 = new Cat(); 25 | Dog dog6 = (Dog) animal4; //fail 26 | 27 | Animal animal5 = new Animal(); 28 | Dog dog7 = (Dog) animal5; //fail 29 | } 30 | 31 | } 32 | 33 | class Animal{ 34 | 35 | } 36 | 37 | class Dog extends Animal{ 38 | 39 | } 40 | 41 | class Cat extends Animal{ 42 | 43 | } 44 | 45 | class Pupi extends Dog{ 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/ClassObj$A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/ClassObj$A.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/ClassObj.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/ClassObj.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/ClassObj.java: -------------------------------------------------------------------------------- 1 | class ClassObj { 2 | 3 | static Class klass; 4 | 5 | public static void main(String[] args) { 6 | Class c1 = A.class; 7 | c1.hashCode(); 8 | klass = A.class; 9 | Class c2 = klass; 10 | c2.hashCode(); 11 | } 12 | 13 | static class A { 14 | 15 | static { 16 | Object o = new Object(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/ComplexAssign.java: -------------------------------------------------------------------------------- 1 | public class ComplexAssign { 2 | 3 | public static void main(String[] args) { 4 | B b1 = new B(); 5 | B b2 = new B(); 6 | B b3 = new B(); 7 | B b4 = b1; 8 | b4 = b2; 9 | B b5 = b1; 10 | b5 = b3; 11 | b5 = b4; 12 | 13 | } 14 | } 15 | 16 | class B { 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Cycle.java: -------------------------------------------------------------------------------- 1 | class Cycle { 2 | public static void main(String[] args) { 3 | cycle(); 4 | } 5 | 6 | public static void cycle() { 7 | B b1 = new B(); 8 | B b2 = new B(); 9 | A a1 = new A(b1); 10 | A a2 = new A(b2); 11 | b2 = a1.b; 12 | b1 = a2.b; 13 | } 14 | } 15 | 16 | class A { 17 | B b; 18 | 19 | A(B b) { 20 | this.b = b; 21 | } 22 | } 23 | 24 | class B { 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch.java: -------------------------------------------------------------------------------- 1 | class Dispatch { 2 | public static void main(String[] args) { 3 | A a = new A(); 4 | a = new B(); 5 | a = new C(); 6 | T t = a.foo(); 7 | } 8 | } 9 | 10 | class A { 11 | T foo() { 12 | return new T(1); 13 | } 14 | } 15 | 16 | class B extends A { 17 | T foo() { 18 | return new T(2); 19 | } 20 | } 21 | 22 | class C extends A { 23 | T foo() { 24 | return new T(3); 25 | } 26 | } 27 | 28 | class T { 29 | int x; 30 | 31 | T(int x) { 32 | this.x = x; 33 | } 34 | } -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch2$C1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/Dispatch2$C1.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch2$I1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/Dispatch2$I1.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch2$I2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/Dispatch2$I2.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch2$I3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/Dispatch2$I3.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch2$I4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/Dispatch2$I4.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/basic/Dispatch2.class -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Dispatch2.java: -------------------------------------------------------------------------------- 1 | class Dispatch2 { 2 | public static void main(String[] args) { 3 | C1 c1 = new C1(); 4 | c1.bar(); 5 | } 6 | 7 | static interface I1 { 8 | public void foo(); 9 | } 10 | 11 | static interface I2 extends I1 { 12 | } 13 | 14 | static interface I3 extends I2 { 15 | @Override 16 | default void foo() { 17 | } 18 | } 19 | 20 | static interface I4 extends I2, I3 { 21 | } 22 | 23 | static class C1 implements I4 { 24 | public void bar() { 25 | I4.super.foo(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/InstanceField.java: -------------------------------------------------------------------------------- 1 | class InstanceField { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | a.longAP(); 6 | a.cycle(); 7 | a.callField(); 8 | } 9 | } 10 | 11 | class A { 12 | B b; 13 | 14 | void longAP() { 15 | A a = new A(); 16 | a.b = new B(); 17 | a.b.c = new C(); 18 | a.b.c.d = new D(); 19 | D x = a.b.c.d; 20 | } 21 | 22 | void cycle() { 23 | A a = new A(); 24 | B b = new B(); 25 | b.a = a; 26 | a.b = b; 27 | A x = b.a.b.a; 28 | } 29 | 30 | void callField() { 31 | A a = new A(); 32 | B b = new B(); 33 | a.b = b; 34 | C c = a.b.foo(); 35 | } 36 | } 37 | 38 | class B { 39 | A a; 40 | C c; 41 | 42 | C foo() { 43 | C x = new C(); 44 | return x; 45 | } 46 | } 47 | 48 | class C { 49 | D d; 50 | } 51 | 52 | class D { 53 | } 54 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/InstanceField2.java: -------------------------------------------------------------------------------- 1 | public class InstanceField2 { 2 | 3 | private Object field; 4 | 5 | public static void main(String[] args) { 6 | entry1(); 7 | entry2(); 8 | } 9 | 10 | public static void entry1() { 11 | new InstanceField2().f(); 12 | } 13 | 14 | public static void entry2() { 15 | new InstanceField2().f(); 16 | } 17 | 18 | private void f() { 19 | field = new Object(); 20 | g(); 21 | } 22 | 23 | private void g() { 24 | Object local = field; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Interface.java: -------------------------------------------------------------------------------- 1 | interface Number { 2 | int get(); 3 | } 4 | 5 | public class Interface { 6 | 7 | public static void main(String[] args) { 8 | Number n = new One(); 9 | n.get(); 10 | } 11 | } 12 | 13 | class Zero implements Number { 14 | 15 | public int get() { 16 | return 0; 17 | } 18 | } 19 | 20 | class One implements Number { 21 | 22 | public int get() { 23 | return 1; 24 | } 25 | } 26 | 27 | class Two implements Number { 28 | 29 | public int get() { 30 | return 2; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/MergeParam.java: -------------------------------------------------------------------------------- 1 | class MergeParam { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | A a2 = new A(); 6 | 7 | A result = foo(a1); 8 | result = foo(a2); 9 | } 10 | 11 | public static A foo(A a) { 12 | return a; 13 | } 14 | 15 | } 16 | 17 | class A { 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/MultiArray.java: -------------------------------------------------------------------------------- 1 | class MultiArray { 2 | 3 | public static void main(String[] args) { 4 | A a = new A().f(); 5 | } 6 | } 7 | 8 | class A { 9 | 10 | A f() { 11 | int[] iarr = new int[10]; 12 | iarr[0] = 0; 13 | 14 | A[][][] arr = new A[1][1][1]; 15 | arr[0][0][0] = new A(); 16 | A a = arr[0][0][0]; 17 | 18 | A[][][] arr2 = new A[10][10][]; 19 | arr2[0][0] = new A[2]; 20 | A[] aa = arr2[0][0]; 21 | return a; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/MultiReturn.java: -------------------------------------------------------------------------------- 1 | public class MultiReturn { 2 | A foo(A a) { 3 | int x = a.getX(); 4 | if (x % 2 == 0) 5 | return new A(x / 2); 6 | else 7 | return a; 8 | } 9 | 10 | public static void main(String[] args) { 11 | MultiReturn mr = new MultiReturn(); 12 | A a = mr.foo(new A(2)); 13 | } 14 | } 15 | 16 | class A { 17 | int x; 18 | 19 | A(int x) { 20 | this.x = x; 21 | } 22 | 23 | int getX() { 24 | return x; 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Native.java: -------------------------------------------------------------------------------- 1 | class Native { 2 | 3 | public static void main(String[] args) { 4 | Native x = new Native(); 5 | x.hashCode(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/New.java: -------------------------------------------------------------------------------- 1 | public class New { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | B b1 = new B(); 6 | B b2 = new C(); 7 | C c = new C(); 8 | } 9 | } 10 | 11 | class A { 12 | } 13 | 14 | class B { 15 | } 16 | 17 | class C extends B { 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Null.java: -------------------------------------------------------------------------------- 1 | class Null { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | foo(a, null); 6 | A x = returnNull(); 7 | A y = null; 8 | } 9 | 10 | static void foo(A a1, A a2) { 11 | } 12 | 13 | static A returnNull() { 14 | return null; 15 | } 16 | } 17 | 18 | class A { 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Primitive.java: -------------------------------------------------------------------------------- 1 | class Primitive { 2 | 3 | public static void main(String[] args) { 4 | boolean b = true; 5 | A a = new A(); 6 | in(a, 1, a); 7 | int i = 10; 8 | in(a, i, a); 9 | int x = out(); 10 | } 11 | 12 | static void in(A a1, int n, A a2) { 13 | } 14 | 15 | static int out() { 16 | return 222; 17 | } 18 | } 19 | 20 | class A { 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Primitives.java: -------------------------------------------------------------------------------- 1 | class Primitives { 2 | 3 | public static void main(String[] args) { 4 | int i100 = 100; 5 | int i101 = 101; 6 | int sum = i100 + i101; 7 | 8 | A a1 = new A(); 9 | int x = a1.i1; 10 | A a2 = new A(); 11 | a2.i2 = 666; 12 | int y = a2.i2; 13 | 14 | double z = id(3.14159); 15 | } 16 | 17 | static double id(double n) { 18 | return n; 19 | } 20 | } 21 | 22 | class A { 23 | 24 | int i1 = 333; 25 | 26 | int i2; 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/PropagateNull.java: -------------------------------------------------------------------------------- 1 | class PropagateNull { 2 | 3 | public static void main(String[] args) { 4 | A a = null; 5 | if (args.length > 0) { 6 | a = new A(); 7 | } 8 | String s = foo(a); 9 | } 10 | 11 | static String foo(A a) { 12 | a.f = null; 13 | Object nn = a.f; 14 | a.hashCode(); 15 | 16 | Object o = null; 17 | String s = (String) o; 18 | return s; 19 | } 20 | } 21 | 22 | class A { 23 | 24 | Object f; 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Recursion.java: -------------------------------------------------------------------------------- 1 | public class Recursion { 2 | public static void main(String[] args) { 3 | A a = new A(); 4 | B b = new B(); 5 | B b5 = a.foo(b); 6 | 7 | } 8 | 9 | 10 | } 11 | 12 | class A { 13 | public B foo(B b) { 14 | B b1 = b; 15 | B b2 = goo(b1); 16 | return b2; 17 | } 18 | 19 | public B goo(B b) { 20 | B b3 = b; 21 | B b4 = foo(b3); 22 | return b4; 23 | } 24 | } 25 | 26 | class B { 27 | 28 | } -------------------------------------------------------------------------------- /src/test/resources/pta/basic/StaticCall.java: -------------------------------------------------------------------------------- 1 | class StaticCall { 2 | 3 | public static void main(String[] args) { 4 | Object o = foo(100, new Object()); 5 | } 6 | 7 | static Object foo(int n, Object o) { 8 | if (n < 0) { 9 | return bar(n, o); 10 | } 11 | return o; 12 | } 13 | 14 | static Object bar(int n, Object o) { 15 | return foo(n--, o); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/StaticField.java: -------------------------------------------------------------------------------- 1 | class StaticField { 2 | 3 | public static void main(String[] args) { 4 | A.b = new B(); 5 | B b = A.b; 6 | } 7 | 8 | } 9 | 10 | class A { 11 | static B b; 12 | } 13 | 14 | class B { 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/StoreLoad.java: -------------------------------------------------------------------------------- 1 | public class StoreLoad { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | B b1 = new B(); 6 | a1.f = b1; 7 | A a2 = a1; 8 | B b2 = a2.f; 9 | } 10 | } 11 | 12 | class A { 13 | B f; 14 | } 15 | 16 | class B { 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/pta/basic/Strings.java: -------------------------------------------------------------------------------- 1 | class Strings { 2 | 3 | public static void main(String[] args) { 4 | String s1 = id("aaa"); 5 | 6 | A a = new A(); 7 | a.f = "bbb"; 8 | String s2 = a.f; 9 | 10 | A.sf = "ccc"; 11 | String s3 = A.sf; 12 | 13 | String[] arr = new String[10]; 14 | arr[0] = "ddd"; 15 | String s4 = arr[0]; 16 | } 17 | 18 | static String id(String s) { 19 | return s; 20 | } 21 | } 22 | 23 | class A { 24 | static String sf; 25 | String f; 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/CallOnly.java: -------------------------------------------------------------------------------- 1 | interface A { 2 | } 3 | 4 | class CallOnly { 5 | public static void main(String args[]) { 6 | B bb = new B(); 7 | C cc = new C(); 8 | Outer1 outer1 = new Outer1(bb); 9 | Outer2 outer2 = new Outer2(cc); 10 | Inner inner = new Inner(); 11 | A result1 = outer1.get(inner); 12 | A result2 = outer2.get(inner); 13 | } 14 | } 15 | 16 | class Outer1 { 17 | B b; 18 | 19 | Outer1(B b) { 20 | this.b = b; 21 | } 22 | 23 | A get(Inner inner) { 24 | return inner.identity(this.b); 25 | } 26 | } 27 | 28 | class Outer2 { 29 | C c; 30 | 31 | Outer2(C c) { 32 | this.c = c 33 | } 34 | 35 | ; 36 | 37 | A get(Inner inner) { 38 | return inner.identity(this.c); 39 | } 40 | } 41 | 42 | class Inner { 43 | A identity(A a) { 44 | return a; 45 | } 46 | } 47 | 48 | class B implements A { 49 | } 50 | 51 | class C implements A { 52 | } 53 | 54 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/LongCallContext.java: -------------------------------------------------------------------------------- 1 | class LongCallContext { 2 | public static void main(String[] args) { 3 | A a1 = new A(); 4 | A a2 = new A(); 5 | a1.foo(new B()); 6 | a2.foo(new B()); 7 | B result = a1.b; 8 | } 9 | } 10 | 11 | class A { 12 | B b; 13 | 14 | void foo(B b) { 15 | goo(b); 16 | } 17 | 18 | void goo(B b) { 19 | hoo(b); 20 | } 21 | 22 | void hoo(B b) { 23 | this.b = b; 24 | } 25 | } 26 | 27 | class B { 28 | } -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/LongObjContext.java: -------------------------------------------------------------------------------- 1 | class LongObjContext { 2 | 3 | public static void main(String[] args) { 4 | new FactCalculator(5).result(); 5 | } 6 | 7 | } 8 | 9 | class FactCalculator { 10 | int n; 11 | 12 | FactCalculator(int n) { 13 | this.n = n; 14 | } 15 | 16 | int result() { 17 | if (n <= 0) { 18 | return 1; 19 | } 20 | return n * new FactCalculator(n - 1).result(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/MustUseHeap.java: -------------------------------------------------------------------------------- 1 | class MustUseHeap { 2 | public static void main(String[] args) { 3 | A a1 = createA(); 4 | a1.f = new B(); 5 | A a2 = createA(); 6 | a2.f = new B(); 7 | B result = a1.f; 8 | } 9 | 10 | public static A createA() { 11 | return new A(); 12 | } 13 | } 14 | 15 | class A { 16 | B f; 17 | } 18 | 19 | class B { 20 | } -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/NestedHeap.java: -------------------------------------------------------------------------------- 1 | class NestedHeap { 2 | public static void main(String args[]) { 3 | House house1 = new House(); 4 | House house2 = new House(); 5 | Bed bed = house1.getBedRoom().bed; 6 | } 7 | } 8 | 9 | class House { 10 | BedRoom bedRoom; 11 | 12 | public House() { 13 | this.bedRoom = new BedRoom(); 14 | } 15 | 16 | public BedRoom getBedRoom() { 17 | return this.bedRoom; 18 | } 19 | } 20 | 21 | class BedRoom { 22 | Bed bed; 23 | 24 | public BedRoom() { 25 | this.bed = new Bed(); 26 | } 27 | 28 | public Bed getBed() { 29 | return this.bed; 30 | } 31 | } 32 | 33 | class Bed { 34 | 35 | } -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/OneCall.java: -------------------------------------------------------------------------------- 1 | class OneCall { 2 | public static void main(String[] args) { 3 | C c = new C(); 4 | c.m(); 5 | } 6 | } 7 | 8 | class C { 9 | 10 | void m() { 11 | Number n1, n2, x, y; 12 | n1 = new One(); 13 | n2 = new Two(); 14 | x = this.id(n1); 15 | y = this.id(n2); 16 | int i = x.get(); // x -> new One, i = 1 17 | } 18 | 19 | Number id(Number n) { 20 | return n; 21 | } 22 | } 23 | 24 | interface Number { 25 | int get(); 26 | } 27 | 28 | class Zero implements Number { 29 | public int get() { 30 | return 0; 31 | } 32 | } 33 | 34 | class One implements Number { 35 | public int get() { 36 | return 1; 37 | } 38 | } 39 | 40 | class Two implements Number { 41 | public int get() { 42 | return 2; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/OneObject.java: -------------------------------------------------------------------------------- 1 | class OneObject { 2 | public static void main(String[] args) { 3 | m(); 4 | } 5 | 6 | static void m() { 7 | A a1 = new A(); 8 | A a2 = new A(); 9 | B b1 = new B(); 10 | B b2 = new B(); 11 | a1.set(b1); 12 | a2.set(b2); 13 | B x = a1.get(); // x -> ? 14 | } 15 | } 16 | 17 | class A { 18 | B f; 19 | 20 | void set(B b) { 21 | this.doSet(b); 22 | } 23 | 24 | void doSet(B p) { 25 | this.f = p; 26 | } 27 | 28 | B get() { 29 | return this.f; 30 | } 31 | } 32 | 33 | class B { 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/OneType.java: -------------------------------------------------------------------------------- 1 | class OneType { 2 | public static void main(String[] args) { 3 | new A().m(); 4 | new B().m(); 5 | } 6 | } 7 | 8 | class A { 9 | void m() { 10 | C c1 = new C(); 11 | c1.set(new D()); 12 | C c2 = new C(); 13 | c2.set(new D()); 14 | D x = c1.get(); 15 | } 16 | } 17 | 18 | class B { 19 | void m() { 20 | C c3 = new C(); 21 | c3.set(new D()); 22 | D y = c3.get(); 23 | } 24 | } 25 | 26 | class C { 27 | D f; 28 | 29 | void set(D p) { 30 | this.f = p; 31 | } 32 | 33 | D get() { 34 | return this.f; 35 | } 36 | } 37 | 38 | class D { 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/RecursiveObj.java: -------------------------------------------------------------------------------- 1 | public class RecursiveObj { 2 | 3 | RecursiveObj next; 4 | 5 | public static void main(String[] args) { 6 | RecursiveObj o1 = new RecursiveObj(null); 7 | RecursiveObj o2 = new RecursiveObj(o1); 8 | RecursiveObj o3 = new RecursiveObj(o2); 9 | RecursiveObj o4 = new RecursiveObj(o3); 10 | o4.count(); 11 | } 12 | 13 | RecursiveObj(RecursiveObj next) { 14 | this.next = next; 15 | } 16 | 17 | int count() { 18 | if (next == null) { 19 | return 1; 20 | } 21 | return 1 + next.count(); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/SpecialHeapContext.java: -------------------------------------------------------------------------------- 1 | class SpecialHeapContext { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | A a2 = new A(); 6 | Object o1 = a1.getMyObject(); 7 | Object o2 = a2.getMyObject(); 8 | } 9 | } 10 | 11 | class A { 12 | 13 | Object getMyObject() { 14 | return new Object(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/StaticSelect.java: -------------------------------------------------------------------------------- 1 | class StaticSelect { 2 | public static void main(String[] args) { 3 | new Int(4).fact(); 4 | } 5 | } 6 | 7 | class Int { 8 | int v; 9 | 10 | Int(int n) { 11 | this.v = n; 12 | } 13 | 14 | int fact() { 15 | return staticFact(this); 16 | } 17 | 18 | static int staticFact(Int n) { 19 | if (n.v <= 0) { 20 | return 1; 21 | } 22 | return n.v * staticFact(new Int(n.v - 1)); 23 | } 24 | } -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/TwoCall.java: -------------------------------------------------------------------------------- 1 | class TwoCall { 2 | public static void main(String[] args) { 3 | m(); 4 | } 5 | 6 | static void m() { 7 | A a = new A(); 8 | B b = a.id(new B()); 9 | B c = a.id(new C()); 10 | } 11 | } 12 | 13 | class A { 14 | B id(B b) { 15 | return _id(b); 16 | } 17 | 18 | B _id(B p) { 19 | return p; 20 | } 21 | } 22 | 23 | class B { 24 | } 25 | 26 | class C extends B { 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/TwoCallOnly.java: -------------------------------------------------------------------------------- 1 | class TwoCallOnly { 2 | public static void main(String[] args) { 3 | B b = new B(); 4 | A a1 = new A(new X()); 5 | A a2 = new A(new X()); 6 | X x1 = a1.fun(b); 7 | X x2 = a2.fun(b); //pts of x1 and x2? 8 | } 9 | } 10 | 11 | class B { 12 | X get(X x) { 13 | return x; 14 | } 15 | } 16 | 17 | class A { 18 | X x; 19 | 20 | A(X x) { 21 | this.x = x; 22 | } 23 | 24 | X fun(B b) { 25 | return b.get(this.x); 26 | } 27 | } 28 | 29 | class X { 30 | } -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/TwoObject.java: -------------------------------------------------------------------------------- 1 | interface Iterator { 2 | Object next(); 3 | } 4 | 5 | class TwoObject { 6 | public static void main(String[] args) { 7 | m(); 8 | } 9 | 10 | static void m() { 11 | List l1 = new List(); 12 | l1.add(new Object()); 13 | List l2 = new List(); 14 | l2.add(new Object()); 15 | 16 | Iterator i1 = l1.iterator(); 17 | Object o1 = i1.next(); 18 | Iterator i2 = l2.iterator(); 19 | Object o2 = i2.next(); 20 | } 21 | } 22 | 23 | class List { 24 | 25 | Object element; 26 | 27 | void add(Object e) { 28 | this.element = e; 29 | } 30 | 31 | Iterator iterator() { 32 | return new ListIterator(); 33 | } 34 | 35 | class ListIterator implements Iterator { 36 | 37 | public Object next() { 38 | return element; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/TypeSens-pta-expected.txt: -------------------------------------------------------------------------------- 1 | Points-to sets of all variables 2 | []:/r0 -> [[]:MergedObj{}] 3 | []:/r1 -> [[]:ConstantObj{java.lang.Class: TypeSens.class}] 4 | []:/r2 -> [[]:EntryPointObj{alloc=MethodParam{/0},type=java.lang.String[] in }] 5 | 6 | Points-to sets of all static fields 7 | 8 | Points-to sets of all instance fields 9 | 10 | Points-to sets of all array indexes 11 | []:EntryPointObj{alloc=MethodParam{/0},type=java.lang.String[] in }[*] -> [[]:EntryPointObj{alloc=MethodParam{/0}[*],type=java.lang.String in }] 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/TypeSens.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/contextsensitivity/TypeSens.class -------------------------------------------------------------------------------- /src/test/resources/pta/contextsensitivity/TypeSens.java: -------------------------------------------------------------------------------- 1 | class TypeSens { 2 | 3 | public static void main(String[] args) { 4 | String s = "xxx"; 5 | s.hashCode(); 6 | Class c = TypeSens.class; 7 | c.getName(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/pta/exception/ExceptionCircle.java: -------------------------------------------------------------------------------- 1 | public class ExceptionCircle { 2 | 3 | public static void main(String[] args) { 4 | try { 5 | m(); 6 | m1(); 7 | } catch (ArithmeticException e1) { 8 | e1.getMessage(); 9 | } catch (IllegalStateException e2) { 10 | e2.getMessage(); 11 | } 12 | } 13 | 14 | public static void m() throws ArithmeticException { 15 | m1(); 16 | throw new ArithmeticException(); 17 | } 18 | 19 | public static void m1() throws IllegalStateException, ArithmeticException { 20 | m(); 21 | throw new IllegalStateException(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/pta/exception/ExceptionCircleAndRecursion.java: -------------------------------------------------------------------------------- 1 | public class ExceptionCircleAndRecursion { 2 | 3 | public static void main(String[] args) { 4 | try { 5 | m(2); 6 | m1(3); 7 | } catch (ArithmeticException e1) { 8 | e1.getMessage(); 9 | } catch (IllegalStateException e2) { 10 | e2.getMessage(); 11 | } 12 | } 13 | 14 | public static void m(int n) throws ArithmeticException { 15 | m1(5); 16 | if (n >= 0) { 17 | m(n - 1); 18 | } 19 | throw new ArithmeticException(); 20 | } 21 | 22 | public static void m1(int k) throws IllegalStateException, ArithmeticException { 23 | m(6); 24 | if (k >= 2) { 25 | m1(k - 2); 26 | } 27 | throw new IllegalStateException(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/pta/exception/ExceptionFromClinit.java: -------------------------------------------------------------------------------- 1 | public class ExceptionFromClinit { 2 | public static void main(String[] args) { 3 | InstanceThrower it = new InstanceThrower(); 4 | it.throwE(); 5 | throwE(); 6 | } 7 | public static void throwE() { 8 | Object.class.toString(); 9 | throw new RuntimeException(); 10 | } 11 | } 12 | class InstanceThrower { 13 | public void throwE() { 14 | StaticThrower.throwE(); 15 | } 16 | } 17 | class StaticThrower { 18 | static { 19 | throwE(); 20 | } 21 | public static void throwE() { 22 | ExceptionFromClinit.throwE(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/pta/exception/ExceptionNoneCaught-pta-expected.txt: -------------------------------------------------------------------------------- 1 | Points-to sets of all variables 2 | []:/temp$0 -> [[]:MergedObj{}] 3 | []:/temp$0 -> [[]:MergedObj{}] 4 | []:/args -> [[]:EntryPointObj{alloc=MethodParam{/0},type=java.lang.String[] in }] 5 | 6 | Points-to sets of all static fields 7 | 8 | Points-to sets of all instance fields 9 | 10 | Points-to sets of all array indexes 11 | []:EntryPointObj{alloc=MethodParam{/0},type=java.lang.String[] in }[*] -> [[]:EntryPointObj{alloc=MethodParam{/0}[*],type=java.lang.String in }] 12 | 13 | -------------------------------------------------------------------------------- /src/test/resources/pta/exception/ExceptionNoneCaught.java: -------------------------------------------------------------------------------- 1 | public class ExceptionNoneCaught { 2 | 3 | public static void main(String[] args) { 4 | m(); 5 | m1(); 6 | } 7 | 8 | public static void m() throws ArithmeticException { 9 | m1(); 10 | throw new ArithmeticException(); 11 | } 12 | 13 | public static void m1() throws IllegalStateException, ArithmeticException { 14 | m(); 15 | throw new IllegalStateException(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/pta/exception/ExceptionTreeAndRecursion.java: -------------------------------------------------------------------------------- 1 | public class ExceptionTreeAndRecursion { 2 | 3 | public static void main(String[] args) { 4 | try { 5 | m(); 6 | m1(); 7 | } catch (ArithmeticException e1) { 8 | e1.getMessage(); 9 | } catch (IllegalStateException e2) { 10 | e2.getMessage(); 11 | } 12 | } 13 | 14 | public static void m() throws ArithmeticException { 15 | throw new ArithmeticException(); 16 | } 17 | 18 | public static void m1() throws IllegalStateException, ArithmeticException { 19 | try { 20 | m(); 21 | m1(); 22 | throw new IllegalStateException(); 23 | } catch (ArithmeticException e1) { 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/A.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Capture.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/Capture.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Capture.java: -------------------------------------------------------------------------------- 1 | import java.util.function.Function; 2 | import java.util.function.Supplier; 3 | 4 | public class Capture { 5 | 6 | public static void main(String[] args) { 7 | Capture capture = new Capture(); 8 | Function addX = (n) -> capture.foo() + n; 9 | int y = addX.apply(100); 10 | Supplier supplier = capture.bar(200); 11 | supplier.get(); 12 | } 13 | 14 | int foo() { 15 | return 100; 16 | } 17 | 18 | Supplier bar(int x) { 19 | Supplier addFoo = () -> foo() + x; 20 | return addFoo; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Function.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/Function.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Function.java: -------------------------------------------------------------------------------- 1 | import java.util.function.BinaryOperator; 2 | 3 | public class Function { 4 | 5 | public static void main(String[] args) { 6 | BinaryOperator functionAdd = (x, y) -> x + y; 7 | Long result = functionAdd.apply(1L, 2L); 8 | System.out.println(result); 9 | 10 | BinaryOperator function = (Long x, Long y) -> x + y; 11 | Long result2 = function.apply(1L, 2L); 12 | System.out.println(result2); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Interface.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/Interface.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/InvokedynamicClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/InvokedynamicClass.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Java9StringConcatenation$MyClass.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/Java9StringConcatenation$MyClass.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Java9StringConcatenation$MyClassNull.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/Java9StringConcatenation$MyClassNull.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Java9StringConcatenation.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/Java9StringConcatenation.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Main.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/Main.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | InvokedynamicClass indy = new InvokedynamicClass(new A()); 4 | indy.run(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/MethodTypes.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/MethodTypes.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/MethodTypes.java: -------------------------------------------------------------------------------- 1 | import java.lang.invoke.MethodType; 2 | 3 | public class MethodTypes { 4 | 5 | public static void main(String[] args) { 6 | MethodType mt0arg = MethodType.methodType(String.class); 7 | MethodType mt1arg = MethodType.methodType(String.class, Object.class); 8 | MethodType mtmt = MethodType.methodType(Object.class, mt1arg); 9 | use(mt0arg, mt1arg, mtmt); 10 | } 11 | 12 | static void use(Object... objects) { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/MultiStatement.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/MultiStatement.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/MultiStatement.java: -------------------------------------------------------------------------------- 1 | import java.util.function.BinaryOperator; 2 | 3 | public class MultiStatement { 4 | 5 | public static void main(String[] args){ 6 | Runnable noArguments = () -> { 7 | System.out.println("Hello World"); 8 | System.out.println("Hello World"); 9 | }; 10 | noArguments.run(); 11 | int result = getValue(3,5); 12 | } 13 | 14 | static int getValue(int input1, int input2){ 15 | BinaryOperator function = (Integer x, Integer y) -> x + y + 2; 16 | Integer result2 = function.apply(input1, input2); 17 | System.out.println(result2); 18 | return result2; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/WithArgs.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/invokedynamic/WithArgs.class -------------------------------------------------------------------------------- /src/test/resources/pta/invokedynamic/WithArgs.java: -------------------------------------------------------------------------------- 1 | import java.awt.event.ActionListener; 2 | 3 | public class WithArgs { 4 | 5 | public static void main(String[] args) { 6 | ActionListener oneArgument = event -> System.out.println("Button pushed"); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/Args$A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/Args$A.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/Args.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/Args.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/B.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/B.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/B.java: -------------------------------------------------------------------------------- 1 | class B { 2 | } 3 | -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/DispatchBugDueToLackOfSubclassCheck$ClassWithInstanceMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/DispatchBugDueToLackOfSubclassCheck$ClassWithInstanceMethod.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/DispatchBugDueToLackOfSubclassCheck$ClassWithStaticMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/DispatchBugDueToLackOfSubclassCheck$ClassWithStaticMethod.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/DispatchBugDueToLackOfSubclassCheck.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/DispatchBugDueToLackOfSubclassCheck.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/ImpreciseLambdas.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/ImpreciseLambdas.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/ImpreciseLambdas.java: -------------------------------------------------------------------------------- 1 | import java.util.function.Consumer; 2 | 3 | class ImpreciseLambdas { 4 | public static void main(String[] args) { 5 | Object[] lambdas = new Object[10]; 6 | int i = 0; 7 | Consumer f1 = x -> print(x); 8 | lambdas[i++] = f1; 9 | Consumer f2 = n -> useInt(n); 10 | lambdas[i++] = f2; 11 | ((Consumer) lambdas[0]).accept(new Object()); 12 | } 13 | 14 | private static void print(Object o) { // pt(o) -> { new Object() } 15 | } 16 | 17 | private static void useInt(Integer i) { // pt(i) should be empty 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaConstructor$A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaConstructor$A.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaConstructor.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaConstructor.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaInstanceMethod$A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaInstanceMethod$A.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaInstanceMethod$B.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaInstanceMethod$B.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaInstanceMethod$C.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaInstanceMethod$C.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaInstanceMethod$I.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaInstanceMethod$I.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaInstanceMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaInstanceMethod.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaStaticMethod$GT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaStaticMethod$GT.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaStaticMethod$LE.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaStaticMethod$LE.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaStaticMethod$Op.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaStaticMethod$Op.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaStaticMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/LambdaStaticMethod.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/LambdaStaticMethod.java: -------------------------------------------------------------------------------- 1 | import java.util.function.Function; 2 | 3 | public class LambdaStaticMethod { 4 | 5 | public static void main(String[] args) { 6 | test(); 7 | } 8 | 9 | static Object test() { 10 | Function fun = (o) -> { 11 | if (o.hashCode() > 0) { 12 | return new GT(); 13 | } else { 14 | return new LE(); 15 | } 16 | }; 17 | return fun.apply(new Object()); 18 | } 19 | 20 | static abstract class Op { 21 | } 22 | 23 | static class GT extends Op { 24 | } 25 | 26 | static class LE extends Op { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/NativeModelWithLambda$A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/NativeModelWithLambda$A.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/NativeModelWithLambda.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/NativeModelWithLambda.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/Streams.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/lambda/Streams.class -------------------------------------------------------------------------------- /src/test/resources/pta/lambda/Streams.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.List; 3 | import java.util.stream.Collectors; 4 | 5 | /** 6 | * Test method reference together with stream. 7 | */ 8 | public class Streams { 9 | 10 | private String arg; 11 | 12 | Streams(String arg) { 13 | this.arg = arg; 14 | } 15 | 16 | public static void main(String[] args) { 17 | List argList = Arrays.asList(args); 18 | List list = argList.stream() 19 | .map(Streams::new) 20 | .collect(Collectors.toList()); 21 | Streams st = list.get(0); 22 | String s = st.arg; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/pta/misc/DefaultMethod$C.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/misc/DefaultMethod$C.class -------------------------------------------------------------------------------- /src/test/resources/pta/misc/DefaultMethod$I.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/misc/DefaultMethod$I.class -------------------------------------------------------------------------------- /src/test/resources/pta/misc/DefaultMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/misc/DefaultMethod.class -------------------------------------------------------------------------------- /src/test/resources/pta/misc/DefaultMethod.java: -------------------------------------------------------------------------------- 1 | class DefaultMethod { 2 | 3 | public static void main(String[] args) { 4 | I i = new C(); 5 | i.foo(); 6 | C c = new C(); 7 | c.foo(); 8 | } 9 | 10 | interface I { 11 | default void foo() { 12 | } 13 | 14 | void bar(); 15 | } 16 | 17 | static class C implements I { 18 | @Override 19 | public void bar() { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/pta/misc/TestMap.java: -------------------------------------------------------------------------------- 1 | import java.util.HashMap; 2 | import java.util.Map; 3 | import java.util.concurrent.ConcurrentHashMap; 4 | import java.util.concurrent.ConcurrentMap; 5 | 6 | class TestMap { 7 | 8 | public static void main(String[] args) { 9 | Map m = new HashMap(); 10 | m.put("string", new String("new String()")); 11 | m.put("class", TestMap.class); 12 | System.out.println(getMap(m, "string")); 13 | 14 | ConcurrentMap cm = new ConcurrentHashMap(); 15 | cm.put("object", new Object()); 16 | cm.put("testmap", new TestMap()); 17 | System.out.println(getConcurrentMap(cm, "object")); 18 | } 19 | 20 | static Object getMap(Map m, String key) { 21 | return m.get(key); 22 | } 23 | 24 | static Object getConcurrentMap(ConcurrentMap m, String key) { 25 | return m.get(key); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/pta/misc/Threads.java: -------------------------------------------------------------------------------- 1 | class Threads { 2 | 3 | public static void main(String[] args) { 4 | Thread t = new Thread(new Runnable() { 5 | @Override 6 | public void run() { 7 | foo(); 8 | } 9 | }); 10 | t.start(); 11 | Thread t2 = Thread.currentThread(); 12 | } 13 | 14 | static void foo() { 15 | Object o = new Object(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/pta/reflection/GetMember.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/reflection/GetMember.class -------------------------------------------------------------------------------- /src/test/resources/pta/reflection/GetMethods.java: -------------------------------------------------------------------------------- 1 | import java.lang.reflect.Method; 2 | 3 | public class GetMethods { 4 | 5 | public static void main(String[] args) throws Exception { 6 | invokeOneArg("foo"); 7 | invokeOneArg("bar"); 8 | } 9 | 10 | static void invokeOneArg(String name) throws Exception { 11 | Method[] methods = J.class.getMethods(); 12 | for (Method m : methods) { 13 | if (m.getName().equals(name)) { 14 | J j = new J(); 15 | m.invoke(j, j); // , 16 | } 17 | } 18 | } 19 | } 20 | 21 | class I { 22 | 23 | public void bar(I i) { 24 | System.out.println("I.bar(I)"); 25 | } 26 | 27 | void bar(J j) { 28 | System.out.println("I.bar(J)"); 29 | } 30 | } 31 | 32 | class J extends I { 33 | 34 | public void foo(J j) { 35 | System.out.println("J.foo(J)"); 36 | } 37 | 38 | void foo(String s) { 39 | System.out.println("J.foo(String)"); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/pta/reflection/LazyHeapModeling.java: -------------------------------------------------------------------------------- 1 | class LazyHeapModeling { 2 | 3 | public static void main(String[] args) throws Exception { 4 | String name = args[0]; 5 | Class c = Class.forName(name); 6 | Object o = c.newInstance(); 7 | castToV(o); 8 | } 9 | 10 | private static void castToV(Object o) { 11 | V v = (V) o; 12 | v.toString(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/pta/reflection/ReflectiveAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/reflection/ReflectiveAction.class -------------------------------------------------------------------------------- /src/test/resources/pta/reflection/U.java: -------------------------------------------------------------------------------- 1 | class U extends V { 2 | 3 | public static Object stat = new Object(); 4 | 5 | public Object inst = new W(); 6 | 7 | public U(V v) { 8 | } 9 | 10 | U() { 11 | } 12 | 13 | private U(Object o) { 14 | } 15 | 16 | void foo() { 17 | } 18 | 19 | @Override 20 | public void foo(U u) { 21 | } 22 | 23 | private void foo(int i) { 24 | } 25 | 26 | void bar() { 27 | } 28 | 29 | @Override 30 | public Object baz(V v, String s) { 31 | return new Object(); 32 | } 33 | 34 | public static void staticFoo(Object o) { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/pta/reflection/V.java: -------------------------------------------------------------------------------- 1 | class V { 2 | 3 | public void foo(U u) { 4 | } 5 | 6 | public void foo(V v) { 7 | } 8 | 9 | public Object baz(V v, String s) { 10 | return new Object(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/pta/reflection/W.java: -------------------------------------------------------------------------------- 1 | class W { 2 | 3 | static Object f = new Object(); 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/ArgToResult.java: -------------------------------------------------------------------------------- 1 | class ArgToResult { 2 | 3 | public static void main(String[] args) { 4 | String taint = SourceSink.source(); 5 | String s1 = new String(); 6 | String s2 = s1.concat(taint); 7 | SourceSink.sink(s2); // taint 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/ArrayTaint.java: -------------------------------------------------------------------------------- 1 | class ArrayTaint { 2 | public static void main(String[] args) { 3 | String[] arr = new String[10]; 4 | for (int i = 0; i < arr.length; i++) { 5 | arr[i] = SourceSink.source(); 6 | } 7 | SourceSink.sink(join(",", arr)); 8 | } 9 | 10 | public static String join(String delim, String[] strings) {] 11 | if (strings == null || strings.length == 0) { 12 | return ""; 13 | } 14 | StringBuilder sb = new StringBuilder(); 15 | for (int i = 0; i < strings.length - 1; i++) { 16 | sb.append(strings[i]); 17 | sb.append(delim); 18 | } 19 | sb.append(strings[strings.length - 1]); 20 | return sb.toString(); 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/pta/taint/BaseToResult.java: -------------------------------------------------------------------------------- 1 | class BaseToResult { 2 | 3 | public static void main(String[] args) { 4 | String taint = SourceSink.source(); 5 | String s1 = new String(); 6 | String s2 = taint.concat(s1); 7 | SourceSink.sink(s2); // taint 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/CSBackPropagation.java: -------------------------------------------------------------------------------- 1 | class CSBackPropagation { 2 | 3 | private char[] buffer = new char[100]; 4 | 5 | public static void main(String[] args) { 6 | CSBackPropagation csbp1 = new CSBackPropagation(); 7 | String taint1 = SourceSink.source(); 8 | String s1 = csbp1.transfer(taint1); 9 | SourceSink.sink(s1); 10 | 11 | CSBackPropagation csbp2 = new CSBackPropagation(); 12 | String noTaint = "no taint"; 13 | String s2 = csbp2.transfer(noTaint); 14 | SourceSink.sink(s2); 15 | 16 | CSBackPropagation csbp3 = new CSBackPropagation(); 17 | String taint2 = SourceSink.source(); 18 | String s3 = csbp3.transfer(taint2); 19 | SourceSink.sink(s3); 20 | } 21 | 22 | String transfer(String s) { 23 | s.getChars(0, s.length(), buffer, 0); 24 | return new String(buffer); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/CSTaint.java: -------------------------------------------------------------------------------- 1 | class CSTaint { 2 | 3 | public static void main(String[] args) { 4 | A a1 = new A(); 5 | String s1 = new String(); 6 | a1.set(s1); 7 | SourceSink.sink(a1.get()); 8 | 9 | A a2 = new A(); 10 | String s2 = SourceSink.source(); 11 | a2.set(s2); 12 | SourceSink.sink(a2.get()); // taint 13 | } 14 | 15 | static class A { 16 | String f; 17 | 18 | String get() { 19 | return f; 20 | } 21 | 22 | void set(String s) { 23 | this.f = s; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/CharArray.java: -------------------------------------------------------------------------------- 1 | class CharArray { 2 | 3 | public static void main(String[] args) { 4 | String s1 = SourceSink.source(); 5 | char[] chars = s1.toCharArray(); 6 | String s2 = new String(chars); 7 | SourceSink.sink(s2); // taint 8 | 9 | String s3 = new String(); 10 | SourceSink.sink(s3); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/ComplexTaint.java: -------------------------------------------------------------------------------- 1 | class ComplexTaint { 2 | public static void main(String args[]) { 3 | String s1 = new String(); 4 | s1 = SourceSink.source(); 5 | String s2 = s1; 6 | String s3 = s2; 7 | SourceSink.sink(s3); 8 | 9 | 10 | String s4 = new String(); 11 | String s5 = s4; 12 | s5 = SourceSink.source(); 13 | String s6 = s5; 14 | SourceSink.sink(s6); 15 | 16 | s5 = s2.concat(new String()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/CycleTaint.java: -------------------------------------------------------------------------------- 1 | class CycleTaint { 2 | public static void main(String args[]) { 3 | String s1 = new String(); 4 | SourceSink.sink(s1); 5 | 6 | String s2 = s1; 7 | String s3 = s2; 8 | s1 = s3; 9 | 10 | s3 = SourceSink.source(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/pta/taint/FieldTaint.java: -------------------------------------------------------------------------------- 1 | class FieldTaint { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | B b = new B(); 6 | b.g = a; 7 | b.g.f = SourceSink.source(); 8 | foo(b); 9 | } 10 | 11 | static void foo(B b) { 12 | SourceSink.sink(b.g.f); // taint 13 | } 14 | 15 | static class A { 16 | String f; 17 | } 18 | 19 | static class B { 20 | A g; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/InterTaintTransfer.java: -------------------------------------------------------------------------------- 1 | class InterTaintTransfer { 2 | 3 | public static void main(String[] args) { 4 | String t1 = SourceSink.source(); 5 | String t2 = SourceSink.source(); 6 | String t3 = SourceSink.source(); 7 | String s = new String(); 8 | SourceSink.sink(transfer(t1, s)); 9 | SourceSink.sink(transfer(t2, s)); 10 | SourceSink.sink(transfer(s, t3)); 11 | } 12 | 13 | static String transfer(String s1, String s2) { 14 | return s1.concat(s2); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/Java9StringConcat.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/pta/taint/Java9StringConcat.class -------------------------------------------------------------------------------- /src/test/resources/pta/taint/Java9StringConcat.java: -------------------------------------------------------------------------------- 1 | class Java9StringConcat { 2 | 3 | public static void main(String[] args) { 4 | stringConcat(); 5 | } 6 | 7 | static void stringConcat() { 8 | String taint = SourceSink.source(); 9 | String s = "abc" + taint + "xyz"; 10 | SourceSink.sink(s); // taint 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/OneCallTaint.java: -------------------------------------------------------------------------------- 1 | class OneCallTaint { 2 | public static void main(String args[]) { 3 | String s1 = new String(); //s1 safe 4 | String s2 = SourceSink.source(); //s2 not safe 5 | 6 | String ss1 = identity(s1); //ss1 safe, but ci mix s2 in ss1. 7 | String ss2 = identity(s2);// ss2 not safe 8 | 9 | SourceSink.sink(ss1); 10 | 11 | } 12 | 13 | static String identity(String s) { 14 | return s; 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/test/resources/pta/taint/Sanitizer.java: -------------------------------------------------------------------------------- 1 | class Sanitizer { 2 | 3 | static String sanitize(String input) { 4 | return input; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/SimpleTaint.java: -------------------------------------------------------------------------------- 1 | class SimpleTaint { 2 | 3 | public static void main(String[] args) { 4 | String s1 = SourceSink.source(); 5 | SourceSink.sink(s1); // taint 6 | 7 | String s2 = SourceSink.source(); 8 | SourceSink.sink(s2); // taint 9 | 10 | String s3 = args == null ? s1 : s2; 11 | SourceSink.sink(s3, 0); // 2 taints 12 | 13 | SourceSink.sink(s3, new String()); // no taint 14 | 15 | String s4 = Sanitizer.sanitize(s1); 16 | SourceSink.sink(s4); // no taint 17 | 18 | String s5 = SourceSink.tainted1; 19 | SourceSink.sink(s5); // taint 20 | 21 | String s6 = SourceSink.untainted; 22 | SourceSink.sink(s6); // no taint 23 | 24 | String s7 = new SourceSink().tainted2; 25 | SourceSink.sink(s7); // taint 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/SourceSink.java: -------------------------------------------------------------------------------- 1 | class SourceSink { 2 | 3 | static String tainted1; 4 | 5 | static String untainted; 6 | 7 | String tainted2; 8 | 9 | static String source() { 10 | return new String(); 11 | } 12 | 13 | static void sink(String s) { 14 | } 15 | 16 | static void sink(String s, int n) { 17 | } 18 | 19 | static void sink(String s1, String s2) { 20 | } 21 | 22 | static String sourceAndSink(String s1, String s2) { 23 | return new String(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/StaticTaintTransfer.java: -------------------------------------------------------------------------------- 1 | class StaticTaintTransfer { 2 | 3 | public static void main(String[] args) { 4 | String arr[] = new String[1]; 5 | arr[0] = SourceSink.source(); 6 | String result[] = mapString(arr, new Mapper() { 7 | @Override 8 | public String map(String s) { 9 | return concat("hello, ", s); 10 | } 11 | }); 12 | SourceSink.sink(result[0]); 13 | } 14 | 15 | static String concat(String lhs, String rhs) { 16 | return new String(); 17 | } 18 | 19 | static String[] mapString(String arr[], Mapper mapper) { 20 | String result[] = new String[arr.length]; 21 | for (int i = 0; i < arr.length; ++i) { 22 | result[i] = mapper.map(arr[i]); 23 | } 24 | return result; 25 | } 26 | } 27 | 28 | interface Mapper { 29 | public String map(String s); 30 | } -------------------------------------------------------------------------------- /src/test/resources/pta/taint/StringAppend.java: -------------------------------------------------------------------------------- 1 | class StringAppend { 2 | 3 | public static void main(String[] args) { 4 | stringAdd(); 5 | stringBuffer(); 6 | stringBuilder(); 7 | } 8 | 9 | static void stringAdd() { 10 | String taint = SourceSink.source(); 11 | String s = "abc" + taint + "xyz"; 12 | SourceSink.sink(s); // taint 13 | } 14 | 15 | static void stringBuffer() { 16 | String taint = SourceSink.source(); 17 | StringBuffer sb = new StringBuffer(); 18 | sb.append("abc"); 19 | sb.append(taint); 20 | sb.append("xyz"); 21 | String s = sb.toString(); 22 | SourceSink.sink(s); // taint 23 | } 24 | 25 | static void stringBuilder() { 26 | String taint = SourceSink.source(); 27 | StringBuilder sb = new StringBuilder(); 28 | sb.append("abc"); 29 | sb.append(taint); 30 | sb.append("xyz"); 31 | String s = sb.toString(); 32 | SourceSink.sink(s); // taint 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/TaintCorner.java: -------------------------------------------------------------------------------- 1 | class TaintCorner { 2 | public static void main(String args[]) { 3 | corner1(); 4 | corner2(); 5 | } 6 | 7 | 8 | public static void corner1() {//taint obj flow to wrong sink index 9 | String taint = SourceSink.source(); 10 | String s = new String(); 11 | SourceSink.sink(taint, s); 12 | } 13 | 14 | public static void corner2() {//source&sink in one method 15 | String s1 = SourceSink.source(); 16 | String s2 = new String(); 17 | String taint = SourceSink.sourceAndSink(s1, s2); 18 | SourceSink.sink(taint); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /src/test/resources/pta/taint/TaintParam.java: -------------------------------------------------------------------------------- 1 | class TaintParam { 2 | 3 | public static void main(String[] args) { 4 | paramSource(args, args); 5 | } 6 | 7 | static void paramSource(String[] taint, String[] noTaint) { 8 | String[] sa1 = taint; 9 | String[] sa2 = sa1; 10 | sink(sa2); // taint 11 | sink(noTaint); // no taint 12 | } 13 | 14 | static void sink(String[] sa) { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/TwoObjectTaint.java: -------------------------------------------------------------------------------- 1 | interface Iterator { 2 | String next(); 3 | } 4 | 5 | class TwoObjectTaint { 6 | public static void main(String[] args) { 7 | List l1 = new List(); 8 | l1.add(SourceSink.source()); 9 | List l2 = new List(); 10 | l2.add(SourceSink.source()); 11 | 12 | Iterator i1 = l1.iterator(); 13 | SourceSink.sink(i1.next()); 14 | Iterator i2 = l2.iterator(); 15 | SourceSink.sink(i2.next()); 16 | } 17 | } 18 | 19 | class List { 20 | 21 | String element; 22 | 23 | void add(String e) { 24 | this.element = e; 25 | } 26 | 27 | Iterator iterator() { 28 | return new ListIterator(); 29 | } 30 | 31 | class ListIterator implements Iterator { 32 | public String next() { 33 | return element; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/taint-config-array-field-transfer.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - { kind: call, method: "", index: result, type: "C" } 3 | 4 | sinks: 5 | - { method: "", index: 0 } 6 | - { method: "", index: base } 7 | 8 | transfers: 9 | - { method: "", from: 0, to: base, type: "C" } 10 | - { method: "(java.lang.Object[])>", from: "0[*]", to: base } 11 | - { method: "(ABox)>", from: 0.a, to: base } 12 | - { method: "", from: 0, to: "1[*]" } 13 | - { method: "", from: 0, to: 1.a } 14 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/taint-config-call-site-model.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - { kind: call, method: "", index: result } 3 | 4 | sinks: 5 | - { method: "", index: 0 } 6 | 7 | transfers: 8 | - { method: "", from: 0, to: base } 9 | - { method: "", from: base, to: result } 10 | 11 | call-site-mode: true 12 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/taint-config-instance-source-sink.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - { kind: call, method: "", index: result } 3 | - { kind: call, method: "", index: base } 4 | - { kind: call, method: "", index: 0 } 5 | - { kind: param, method: "", index: 0 } 6 | 7 | sinks: 8 | - { method: "", index: 0 } 9 | - { method: "", index: 0 } 10 | - { method: "", index: base } 11 | 12 | transfers: 13 | - { method: "(java.lang.String[])>", from: 0, to: base } 14 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/taint-config-param-source.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - { kind: param, method: "", index: 0 } 3 | 4 | sinks: 5 | - { method: "", index: 0 } 6 | -------------------------------------------------------------------------------- /src/test/resources/pta/taint/taint-config-static-taint-transfer.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | - { kind: call, method: "", index: result } 3 | 4 | sinks: 5 | - { method: "", index: 0 } 6 | - { method: "", index: 0 } 7 | - { method: "", index: 1 } 8 | 9 | transfers: 10 | - { method: "", from: 0, to: result } 11 | - { method: "", from: 1, to: result } 12 | -------------------------------------------------------------------------------- /src/test/resources/sideeffect/BubbleSort.java: -------------------------------------------------------------------------------- 1 | public class BubbleSort { 2 | 3 | public static void main(String[] args) { 4 | int[] array = new int[]{3, 4, 1, 2, 5}; 5 | bubbleSort(array, 5); 6 | } 7 | 8 | public static void bubbleSort(int[] array, int len) { 9 | for (int i=0; i < len; i++) { 10 | for (int j=i+1; j < len; j++) { 11 | if (array[i] > array[j]) { 12 | int tmp = array[i]; 13 | array[i] = array[j]; 14 | array[j] = tmp; 15 | } 16 | } 17 | } 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /src/test/resources/sideeffect/ConstructorTest-side-effect-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- ()> (side-effect) -------------------- 2 | [0@L12] invokespecial %this.()>(); [] 3 | [2@L10] %this. = temp$0; [NewObj{[0@L4] new A}] 4 | 5 | -------------------- (side-effect) -------------------- 6 | [1@L4] invokespecial temp$0.()>(); [NewObj{[0@L4] new A}] 7 | 8 | -------------------------------------------------------------------------------- /src/test/resources/sideeffect/ConstructorTest.java: -------------------------------------------------------------------------------- 1 | public class ConstructorTest { 2 | 3 | public static void main(String[] args) { 4 | A a = new A(); 5 | } 6 | 7 | } 8 | 9 | class A { 10 | A a = null; 11 | 12 | A() { 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/sideeffect/Inheritance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This testcase is taken from https://github.com/saffriha/ictac2014 3 | */ 4 | 5 | public class Inheritance { 6 | public static void main(String[] args) { 7 | B bb = new B(); bb.m(); bb.n(); bb.f(); 8 | C cc = new C(); cc.m(); cc.n(); cc.f(); 9 | } 10 | } 11 | 12 | class A { 13 | public Object a = new Object(); 14 | } 15 | 16 | class B extends A { 17 | public Object m() { return this.a; } 18 | public Object n() { return ((A)this).a; } 19 | public Object f() { return (this == null) ? this.a : ((A) this).a; } 20 | } 21 | 22 | class C extends A { 23 | public Object a = new Object(); 24 | 25 | public Object m() { return this.a; } 26 | public Object n() { return ((A)this).a; } 27 | public Object f() { return (this == null) ? this.a : ((A) this).a; } 28 | } -------------------------------------------------------------------------------- /src/test/resources/sideeffect/Milanova.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This testcase is taken from Milanova et al. 3 | */ 4 | 5 | public class Milanova { 6 | public static void main(String[] args) { 7 | Y y = new Y(); 8 | Z z = new Z(); 9 | B b = new B(y); 10 | C c = new C(z); 11 | b.m(); 12 | c.m(); 13 | } 14 | } 15 | 16 | class X { 17 | void n() {} 18 | } 19 | 20 | class Y extends X{ 21 | void n() {} 22 | } 23 | 24 | class Z extends X { 25 | void n() {} 26 | } 27 | 28 | class O { 29 | X f; 30 | 31 | O(X xo) {this.f = xo;} 32 | } 33 | 34 | class A extends O { 35 | X f; 36 | A(X xa) { 37 | super(xa); 38 | } 39 | } 40 | 41 | class B extends A { 42 | B(X xb) { 43 | super(xb); 44 | } 45 | void m() { 46 | X xb = this.f; 47 | xb.n(); 48 | } 49 | } 50 | 51 | class C extends A { 52 | C(X xc) { 53 | super(xc); 54 | } 55 | void m() { 56 | X xc = this.f; 57 | xc.n(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/test/resources/sideeffect/PolyLoop.java: -------------------------------------------------------------------------------- 1 | public class PolyLoop { 2 | 3 | void test() { 4 | Node[] nodes = new Node[2]; 5 | nodes[0] = new Body(); 6 | nodes[1] = new Cell(); 7 | for (Node node : nodes) { 8 | Node n = node; 9 | if (n instanceof Body) { 10 | n = (Body) n; 11 | n.foo(); 12 | } 13 | } 14 | } 15 | 16 | public static void main(String[] args) { 17 | PolyLoop a = new PolyLoop(); 18 | a.test(); 19 | } 20 | } 21 | 22 | abstract class Node { 23 | public A f; 24 | 25 | abstract void foo(); 26 | } 27 | 28 | class Body extends Node { 29 | void foo() { 30 | 31 | } 32 | } 33 | 34 | class Cell extends Node { 35 | void foo() { 36 | this.f = new A(); 37 | } 38 | } 39 | 40 | 41 | class A {} 42 | -------------------------------------------------------------------------------- /src/test/resources/sideeffect/PrimitiveTest.java: -------------------------------------------------------------------------------- 1 | public class PrimitiveTest { 2 | 3 | static void pure(A a) { 4 | } 5 | 6 | public static void main(String[] args) { 7 | A a = new A(1); 8 | pure(a); 9 | a.mod(); 10 | pure(a); 11 | } 12 | } 13 | 14 | class A { 15 | int a; 16 | 17 | A(int a) { 18 | this.a = a; 19 | } 20 | 21 | public void mod() { 22 | a++; 23 | } 24 | } -------------------------------------------------------------------------------- /src/test/resources/sideeffect/PureTest-side-effect-expected.txt: -------------------------------------------------------------------------------- 1 | -------------------- (side-effect) -------------------- 2 | [4@L4] temp$0[%intconst1] = %intconst2; [NewObj{[1@L4] newarray int[%intconst0]}] 3 | [7@L4] temp$0[%intconst3] = %intconst4; [NewObj{[1@L4] newarray int[%intconst0]}] 4 | [9@L4] temp$0[%intconst5] = %intconst3; [NewObj{[1@L4] newarray int[%intconst0]}] 5 | [10@L4] temp$0[%intconst2] = %intconst5; [NewObj{[1@L4] newarray int[%intconst0]}] 6 | [11@L4] temp$0[%intconst4] = %intconst0; [NewObj{[1@L4] newarray int[%intconst0]}] 7 | [13@L5] invokestatic (array, %intconst0); [] 8 | 9 | -------------------- (side-effect) -------------------- 10 | 11 | -------------------------------------------------------------------------------- /src/test/resources/sideeffect/PureTest.java: -------------------------------------------------------------------------------- 1 | public class PureTest { 2 | 3 | public static void main(String[] args) { 4 | int[] array = new int[]{3, 4, 1, 2, 5}; 5 | countOnes(array, 5); 6 | } 7 | 8 | public static int countOnes(int[] array, int len) { 9 | int ret = 0; 10 | for (int i=0; i()> (side-effect) -------------------- 2 | [0@L23] invokespecial %this.()>(); [] 3 | 4 | -------------------- ()> (side-effect) -------------------- 5 | [0@L1] invokespecial %this.()>(); [] 6 | 7 | -------------------- (side-effect) -------------------- 8 | 9 | -------------------- (side-effect) -------------------- 10 | [1@L8] invokespecial temp$0.()>(); [] 11 | [3@L9] invokevirtual %this.(c); [] 12 | 13 | -------------------- (side-effect) -------------------- 14 | [1@L13] invokespecial temp$0.()>(); [] 15 | [3@L14] invokevirtual staticStore.(); [] 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/sideeffect/StaticStore.java: -------------------------------------------------------------------------------- 1 | public class StaticStore { 2 | 3 | public void modA(C c) { 4 | A.c = c; 5 | } 6 | 7 | public void mmodA() { 8 | C c = new C(); 9 | modA(c); 10 | } 11 | 12 | public static void main(String[] args) { 13 | StaticStore staticStore = new StaticStore(); 14 | staticStore.mmodA(); 15 | } 16 | 17 | } 18 | 19 | class A { 20 | static C c; 21 | } 22 | 23 | class C { 24 | 25 | } -------------------------------------------------------------------------------- /src/test/resources/util/graph-dominator.txt: -------------------------------------------------------------------------------- 1 | 1->2 2 | 1->3 3 | 2->3 4 | 3->4 5 | 4->3 6 | 4->5 7 | 4->6 8 | 5->7 9 | 6->7 10 | 7->4 11 | 7->8 12 | 8->3 13 | 8->9 14 | 8->10 15 | 10->7 16 | -------------------------------------------------------------------------------- /src/test/resources/util/graph-scc.txt: -------------------------------------------------------------------------------- 1 | 1->1 2 | 2->4 3 | 4->6 4 | 8->9 5 | 9->8 6 | 10->11 7 | 11->12 8 | 12->13 9 | 13->11 10 | -------------------------------------------------------------------------------- /src/test/resources/util/graph-simple.txt: -------------------------------------------------------------------------------- 1 | 1->5 2 | 1->3 3 | 3->6 4 | 9->8 5 | -------------------------------------------------------------------------------- /src/test/resources/util/graph-topsort.txt: -------------------------------------------------------------------------------- 1 | 1->2 2 | 2->3 3 | 3->4 4 | 5->3 5 | 6->5 6 | 7->8 7 | 9->10 8 | -------------------------------------------------------------------------------- /src/test/resources/world/Anno.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Anno.class -------------------------------------------------------------------------------- /src/test/resources/world/Annotated.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Annotated.class -------------------------------------------------------------------------------- /src/test/resources/world/Author.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Author.class -------------------------------------------------------------------------------- /src/test/resources/world/Cards.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Cards.class -------------------------------------------------------------------------------- /src/test/resources/world/ClassAnno.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/ClassAnno.class -------------------------------------------------------------------------------- /src/test/resources/world/ConstVar.java: -------------------------------------------------------------------------------- 1 | class ConstVar { 2 | 3 | int primitiveConst() { 4 | int x = 1 + 2; 5 | int y = 3 * x; 6 | use(666); 7 | return y; 8 | } 9 | 10 | void stringConst() { 11 | use("a string constant"); 12 | use("another string constant"); 13 | } 14 | 15 | void nullConst() { 16 | use(null); 17 | } 18 | 19 | void use(int x) { 20 | } 21 | 22 | void use(Object o) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/world/Copyright.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Copyright.class -------------------------------------------------------------------------------- /src/test/resources/world/DefaultMethod$A.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/DefaultMethod$A.class -------------------------------------------------------------------------------- /src/test/resources/world/DefaultMethod$B.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/DefaultMethod$B.class -------------------------------------------------------------------------------- /src/test/resources/world/DefaultMethod$C.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/DefaultMethod$C.class -------------------------------------------------------------------------------- /src/test/resources/world/DefaultMethod$I.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/DefaultMethod$I.class -------------------------------------------------------------------------------- /src/test/resources/world/DefaultMethod$II.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/DefaultMethod$II.class -------------------------------------------------------------------------------- /src/test/resources/world/DefaultMethod.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/DefaultMethod.class -------------------------------------------------------------------------------- /src/test/resources/world/DefaultMethod.java: -------------------------------------------------------------------------------- 1 | public class DefaultMethod { 2 | 3 | interface I { 4 | default void bar() { 5 | } 6 | } 7 | 8 | interface II extends I { 9 | default void foo() { 10 | } 11 | 12 | default void bar() { 13 | } 14 | } 15 | 16 | class A { 17 | public void foo() { 18 | } 19 | } 20 | 21 | class B extends A { 22 | } 23 | 24 | class C extends B implements II { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/world/FieldsWithSameName.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/FieldsWithSameName.class -------------------------------------------------------------------------------- /src/test/resources/world/Hierarchy.java: -------------------------------------------------------------------------------- 1 | public class Hierarchy { 2 | } 3 | 4 | interface I { 5 | void biu(I i); 6 | } 7 | 8 | interface II { 9 | String fii = "fii"; 10 | } 11 | 12 | interface III extends I, II { 13 | } 14 | 15 | interface IIII extends III { 16 | void baz(boolean b); 17 | 18 | void biubiu(IIII iiii); 19 | } 20 | 21 | class C { 22 | String fc; 23 | 24 | String f; 25 | 26 | void foo(long l) { 27 | } 28 | 29 | void bar() { 30 | } 31 | 32 | public void baz(boolean b) { 33 | } 34 | } 35 | 36 | class D extends C { 37 | } 38 | 39 | abstract class E extends C implements I, II { 40 | String fe; 41 | 42 | String f; 43 | 44 | void foo(int i) { 45 | } 46 | } 47 | 48 | abstract class F implements III { 49 | } 50 | 51 | abstract class G extends E implements IIII { 52 | } 53 | 54 | abstract class H extends F { 55 | } 56 | -------------------------------------------------------------------------------- /src/test/resources/world/IntAnno.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/IntAnno.class -------------------------------------------------------------------------------- /src/test/resources/world/Mahjong.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Mahjong.class -------------------------------------------------------------------------------- /src/test/resources/world/Name.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Name.class -------------------------------------------------------------------------------- /src/test/resources/world/OuterInner.java: -------------------------------------------------------------------------------- 1 | class OuterInner { 2 | 3 | class Outer { 4 | 5 | class Inner1() { 6 | } 7 | 8 | class Inner2() { 9 | } 10 | 11 | class Inner3() { 12 | } 13 | } 14 | 15 | class Inner { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/world/StringAnno.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/StringAnno.class -------------------------------------------------------------------------------- /src/test/resources/world/TestDumper.java: -------------------------------------------------------------------------------- 1 | public abstract class TestDumper { 2 | 3 | private static final double EPSILON = 1.0; 4 | private final int m; 5 | private final int n; 6 | private double[][] a; 7 | private String s; 8 | 9 | TestDumper() { 10 | m = 1; 11 | n = 0; 12 | } 13 | 14 | protected final int foo(int x, Object o) { 15 | int y = x + o.hashCode(); 16 | if (y > 0) { 17 | y = 1; 18 | } 19 | return y; 20 | } 21 | 22 | abstract int abs(int x, double y); 23 | 24 | private abstract class A {} 25 | private interface I {} 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/world/Types.java: -------------------------------------------------------------------------------- 1 | public class Types { 2 | } 3 | 4 | class A { 5 | } 6 | 7 | class B extends A { 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/world/Year.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/Year.class -------------------------------------------------------------------------------- /src/test/resources/world/android$widget$RemoteViews$BaseReflectionAction.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LFYSec/MScan/d84ceb32a0dcfc9545612e5bca39e652e16c4c9d/src/test/resources/world/android$widget$RemoteViews$BaseReflectionAction.class --------------------------------------------------------------------------------