Skip to content

Commit 214a6b8

Browse files
authored
Merge pull request #347 from opalj/feature/project-documentation
Improve the interface and documentation of the Project class
2 parents fb2c28d + e1bb717 commit 214a6b8

File tree

8 files changed

+422
-137
lines changed

8 files changed

+422
-137
lines changed

DEVELOPING_OPAL/validate/src/it/scala/org/opalj/br/reader/DynamicConstantsBytecodeStructureTest.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import org.opalj.bi.TestResources.locateTestResources
1616
import org.opalj.br.analyses.Project
1717
import org.opalj.br.instructions.LDCDynamic
1818
import org.opalj.br.instructions.WIDE
19-
import org.opalj.log.GlobalLogContext
2019

2120
/**
2221
* Test that code with dynamic constants is loaded without exceptions and after rewriting is still
@@ -76,7 +75,7 @@ class DynamicConstantsBytecodeStructureTest extends AnyFunSpec with Matchers {
7675
rewrite = false,
7776
logRewrites = false
7877
)
79-
val project = Project(dynamicConstantsJar, GlobalLogContext, config)
78+
val project = Project(dynamicConstantsJar, config)
8079
info(project.statistics.toList.map(_.toString).filter(_.startsWith("(Project")).mkString(","))
8180

8281
it("should be able to perform abstract interpretation of rewritten dynamic constants " +
@@ -90,7 +89,7 @@ class DynamicConstantsBytecodeStructureTest extends AnyFunSpec with Matchers {
9089
rewrite = true,
9190
logRewrites = false
9291
)
93-
val project = Project(dynamicConstantsJar, GlobalLogContext, config)
92+
val project = Project(dynamicConstantsJar, config)
9493
info(project.statistics.toList.map(_.toString).filter(_.startsWith("(Project")).mkString(","))
9594

9695
it("should be able to rewrite all dynamic constants in the dynamic constants test " +

DEVELOPING_OPAL/validate/src/it/scala/org/opalj/br/reader/InvokedynamicRewritingBytecodeStructureTest.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import org.opalj.br.instructions.INVOKESTATIC
2424
import org.opalj.br.instructions.WIDE
2525
import org.opalj.br.reader.InvokedynamicRewriting.LambdaNameRegEx
2626
import org.opalj.br.reader.InvokedynamicRewriting.TargetMethodNameRegEx
27-
import org.opalj.log.GlobalLogContext
2827

2928
/**
3029
* Test that code with rewritten `invokedynamic` instructions is still valid bytecode.
@@ -116,7 +115,7 @@ class InvokedynamicRewritingBytecodeStructureTest extends AnyFunSpec with Matche
116115
rewrite = true,
117116
logRewrites = false
118117
).withValue(DeleteSynthesizedClassFilesAttributesConfigKey, configValueFalse)
119-
val lambdas = Project(lambdasJar, GlobalLogContext, config)
118+
val lambdas = Project(lambdasJar, config)
120119
info(lambdas.statistics.toList.map(_.toString).filter(_.startsWith("(Project")).mkString(","))
121120

122121
it("should be able to perform abstract interpretation of rewritten Java lambda" +
@@ -135,7 +134,7 @@ class InvokedynamicRewritingBytecodeStructureTest extends AnyFunSpec with Matche
135134
rewrite = true,
136135
logRewrites = false
137136
).withValue(DeleteSynthesizedClassFilesAttributesConfigKey, configValueFalse)
138-
val stringConcat = Project(stringConcatJar, GlobalLogContext, config)
137+
val stringConcat = Project(stringConcatJar, config)
139138
info(stringConcat.statistics.toList.map(_.toString).filter(_.startsWith("(Project")).mkString(","))
140139

141140
it("should be able to perform abstract interpretation of rewritten Java string concat" +
@@ -154,7 +153,7 @@ class InvokedynamicRewritingBytecodeStructureTest extends AnyFunSpec with Matche
154153
rewrite = true,
155154
logRewrites = false
156155
).withValue(DeleteSynthesizedClassFilesAttributesConfigKey, configValueFalse)
157-
val records = Project(recordsJar, GlobalLogContext, config)
156+
val records = Project(recordsJar, config)
158157
info(records.statistics.toList.map(_.toString).filter(_.startsWith("(Project")).mkString(","))
159158

160159
it("should be able to perform abstract interpretation of rewritten Java 16 record" +
@@ -173,7 +172,7 @@ class InvokedynamicRewritingBytecodeStructureTest extends AnyFunSpec with Matche
173172
rewrite = true,
174173
logRewrites = false
175174
).withValue(DeleteSynthesizedClassFilesAttributesConfigKey, configValueFalse)
176-
val jre = Project(jrePath, GlobalLogContext, config)
175+
val jre = Project(jrePath, config)
177176
info(jre.statistics.toList.map(_.toString).filter(_.startsWith("(Project")).mkString(","))
178177
it("should be able to perform abstract interpretation of rewritten Java lambda " +
179178
"expressions in the JRE") {

OPAL/apk/src/main/scala/org/opalj/apk/parser/ApkParser.scala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,7 @@ object ApkParser {
256256

257257
val jarDir = apkParser.parseDexCode(dexParser)._1
258258

259-
val project =
260-
Project(
261-
jarDir.toFile,
262-
GlobalLogContext,
263-
projectConfig
264-
)
259+
val project = Project(jarDir.toFile, projectConfig)
265260

266261
project.updateProjectInformationKeyInitializationData(ApkComponentsKey)(_ => apkParser)
267262
project.get(ApkComponentsKey)

OPAL/bi/src/main/scala/org/opalj/bi/reader/ClassFileReader.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,11 +602,11 @@ trait ClassFileReader extends ClassFileReaderConfiguration with Constant_PoolAbs
602602
/**
603603
* Loads class files from the given file location.
604604
* - If the file denotes a single ".class" file this class file is loaded.
605-
* - If the file object denotes a ".jar|.war|.ear|.zip" file, all class files in the
606-
* jar file will be loaded.
605+
* - If the file object denotes a ".jmod|.jar|.war|.ear|.zip" file, all class files in the
606+
* archive file will be loaded.
607607
* - If the file object specifies a directory object, all ".class" files
608608
* in the directory and in all subdirectories are loaded as well as all
609-
* class files stored in ".jar" files in one of the directories. This class loads
609+
* class files stored in archive files in one of the directories. This class loads
610610
* all class files in parallel. However, this does not affect analyses working on the
611611
* resulting `List`.
612612
*/

OPAL/br/src/it/scala/org/opalj/br/reader/InvokedynamicRewritingTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ abstract class InvokedynamicRewritingTest extends AnyFunSuite {
7777

7878
val logContext = new StandardLogContext
7979
OPALLogger.register(logContext)
80-
val project = Project(libraryPath, logContext, config)
80+
val project = Project(libraryPath, config, logContext)
8181
val proxyFactoryCalls = this.proxyFactoryCalls(project)
8282
assert(proxyFactoryCalls.nonEmpty, "there should be calls to the proxy factories")
8383

0 commit comments

Comments
 (0)