Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed jars branch 20241014 #1146

Merged
merged 12 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,9 @@ public void removeNode(@Nonnull Stmt stmt, boolean keepFlow) {
blockOfRemovedStmt.clearPredecessorBlocks();
blockOfRemovedStmt.clearSuccessorBlocks();
blockOfRemovedStmt.clearExceptionalSuccessorBlocks();

clearBlockFromAllExceptionalBlocks(blockOfRemovedStmt);

blockOfRemovedStmt.removeStmt(blockOfRemovedStmtPair.getLeft());
blocks.remove(blockOfRemovedStmt);

Expand Down Expand Up @@ -977,6 +980,27 @@ public void removeNode(@Nonnull Stmt stmt, boolean keepFlow) {
stmtToBlock.remove(stmt);
}

public void clearBlockFromAllExceptionalBlocks(MutableBasicBlock blockOfRemovedStmt) {
// Remove blockOfRemovedStmt from all exceptionalBlocks in MutableBlockStmtGraph
for (Iterator<MutableBasicBlock> iterator = blocks.iterator(); iterator.hasNext(); ) {
MutableBasicBlock block = iterator.next();
Collection<MutableBasicBlock> blockExceptionalSuccessors =
block.getExceptionalSuccessors().values();
if (!blockExceptionalSuccessors.isEmpty()) {
for (MutableBasicBlock exceptionalBlock : blockExceptionalSuccessors) {
List<MutableBasicBlock> exceptionalBlockSuccessors = exceptionalBlock.getSuccessors();
List<MutableBasicBlock> exceptionalBlockPredecessors = exceptionalBlock.getPredecessors();
if (exceptionalBlockPredecessors.contains(blockOfRemovedStmt)) {
exceptionalBlock.removePredecessorBlock(blockOfRemovedStmt);
}
if (exceptionalBlockSuccessors.contains(blockOfRemovedStmt)) {
exceptionalBlock.removeFromSuccessorBlocks(blockOfRemovedStmt);
}
}
}
}
}

@Override
public void replaceNode(@Nonnull Stmt oldStmt, @Nonnull Stmt newStmt) {
if (oldStmt == newStmt) {
Expand Down
7 changes: 6 additions & 1 deletion sootup.java.bytecode.frontend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
</dependencies>
<dependency>
<groupId>org.soot-oss</groupId>
<artifactId>sootup.jimple.frontend</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package sootup.java.bytecode.frontend.inputlocation;

import categories.TestCategories;
import java.nio.file.Paths;
import java.util.Collections;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import sootup.core.inputlocation.AnalysisInputLocation;
import sootup.core.model.Body;
import sootup.core.model.SourceType;
import sootup.interceptors.NopEliminator;
import sootup.java.core.views.JavaView;
import sootup.jimple.frontend.JimpleAnalysisInputLocation;
import sootup.jimple.frontend.JimpleView;

@Tag(TestCategories.JAVA_8_CATEGORY)
public class FixJars extends BaseFixJarsTest {

@Test
public void executeexamcorejar() {
AnalysisInputLocation inputLocation =
new JimpleAnalysisInputLocation(
Paths.get("./src/test/resources/"),
SourceType.Application,
Collections.singletonList(new NopEliminator()));
JimpleView jimpleView = new JimpleView(inputLocation);
jimpleView
.getClasses()
.forEach(
sootClass -> {
Body body =
sootClass.getMethodsByName("nopEliminatorBug").stream()
.findFirst()
.get()
.getBody();
});
}

@Test
public void executeaudiofileRCjar() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this test. We only want to keep the isolated test version around. But also still keep the Maven coordinates of the original Jar around (maybe as a comment).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I @disable this test? This test case fails locally but the pipeline is green, that's why I asked in the group.

Uploading image.png…

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you investigate why this fails? Maybe due to the resolution of the artifact from Maven Central which might be cached on your machine or the pipeline?

String jarDownloadUrl =
"https://repo1.maven.org/maven2/de/sciss/audiofile_3.0.0-RC2/2.3.3/audiofile_3.0.0-RC2-2.3.3.jar";
String methodSignature =
"<de.sciss.audiofile.AudioFile$AsyncBasic: scala.concurrent.Future close()>";
JavaView javaView = supplyJavaView(jarDownloadUrl);
assertMethodConversion(javaView, methodSignature);
assertJar(javaView);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
class DummyClass extends java.lang.Object {

public int nopEliminatorBug() {
this := @this: io.github.adven27.concordion.extensions.exam.core.logger.LoggingFormatterExtension$LoggingFormatterListener;
event := @parameter0: org.concordion.api.listener.ExampleEvent;
staticinvoke <kotlin.jvm.internal.Intrinsics: void checkNotNullParameter(java.lang.Object,java.lang.String)>(event, "event");

label1:
nop;
$stack5 = this.<io.github.adven27.concordion.extensions.exam.core.logger.LoggingFormatterExtension$LoggingFormatterListener: io.github.adven27.concordion.extensions.exam.core.logger.LoggingAdaptor loggingAdaptor>;
it = interfaceinvoke $stack5.<io.github.adven27.concordion.extensions.exam.core.logger.LoggingAdaptor: java.io.File getLogFile()>();
$stack6 = virtualinvoke it.<java.io.File: boolean exists()>();

if $stack6 == 0 goto label2;
specialinvoke this.<io.github.adven27.concordion.extensions.exam.core.logger.LoggingFormatterExtension$LoggingFormatterListener: void appendLogFileLinkToExample(org.concordion.api.listener.ExampleEvent,java.io.File)>(event, it);

label2:
nop;
nop;

label3:
$stack7 = this.<io.github.adven27.concordion.extensions.exam.core.logger.LoggingFormatterExtension$LoggingFormatterListener: io.github.adven27.concordion.extensions.exam.core.logger.LoggingAdaptor loggingAdaptor>;
interfaceinvoke $stack7.<io.github.adven27.concordion.extensions.exam.core.logger.LoggingAdaptor: void stopLogFile()>();

goto label6;

label4:
$stack8 := @caughtexception;
l2 = $stack8;

label5:
$stack9 = this.<io.github.adven27.concordion.extensions.exam.core.logger.LoggingFormatterExtension$LoggingFormatterListener: io.github.adven27.concordion.extensions.exam.core.logger.LoggingAdaptor loggingAdaptor>;
interfaceinvoke $stack9.<io.github.adven27.concordion.extensions.exam.core.logger.LoggingAdaptor: void stopLogFile()>();

throw l2;

label6:
return;

catch java.lang.Throwable from label1 to label3 with label4;
catch java.lang.Throwable from label4 to label5 with label4;
}
}
Loading