Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swissiety committed Nov 23, 2023
1 parent 272762b commit dcc2ac5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
4 changes: 1 addition & 3 deletions sootup.core/src/main/java/sootup/core/model/SootMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ public boolean isSynchronized() {

/** @return yes if this is the main method */
public boolean isMain(@Nonnull IdentifierFactory idf) {
return isPublic()
&& isStatic()
&& idf.isConstructorSubSignature(getSignature().getSubSignature());
return isPublic() && isStatic() && idf.isMainSubSignature(getSignature().getSubSignature());
}

/** We rely on the JDK class recognition to decide if a method is JDK method. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package sootup.java.bytecode.frontend;

import static junit.framework.Assert.assertTrue;
import static junit.framework.TestCase.fail;

import categories.Java8Test;
import java.util.Arrays;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import sootup.core.model.SootClass;
Expand All @@ -21,7 +21,6 @@
public class AsmMethodSourceTest {

@Test
@Ignore("FIXME")
public void testFix_StackUnderrun_convertPutFieldInsn_init() {

double version = Double.parseDouble(System.getProperty("java.specification.version"));
Expand All @@ -36,17 +35,18 @@ public void testFix_StackUnderrun_convertPutFieldInsn_init() {

JavaView view = javaProject.createView();

final JavaIdentifierFactory idf = JavaIdentifierFactory.getInstance();
JavaClassType mainClassSignature =
JavaIdentifierFactory.getInstance()
.getClassType("javax.management.NotificationBroadcasterSupport");
idf.getClassType("javax.management.NotificationBroadcasterSupport");
MethodSignature mainMethodSignature =
JavaIdentifierFactory.getInstance()
.getMethodSignature(
mainClassSignature,
"<init>",
"void",
Arrays.asList(
"java.util.concurrent.Executor", "javax.management.MBeanNotificationInfo[]"));
idf.getMethodSignature(
mainClassSignature,
"<init>",
"void",
Arrays.asList(
"java.util.concurrent.Executor", "javax.management.MBeanNotificationInfo[]"));

assertTrue(idf.isConstructorSubSignature(mainMethodSignature.getSubSignature()));

final SootClass<?> abstractClass = view.getClass(mainClassSignature).get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import sootup.core.cache.FullCache;
import sootup.core.cache.provider.FullCacheProvider;
import sootup.core.frontend.AbstractClassSource;
import sootup.core.frontend.ResolveException;
import sootup.core.inputlocation.AnalysisInputLocation;
import sootup.core.inputlocation.ClassLoadingOptions;
import sootup.core.inputlocation.EmptyClassLoadingOptions;
Expand Down Expand Up @@ -118,7 +117,7 @@ private boolean isPackageVisibleToModule(

Optional<JavaModuleInfo> moduleInfoOpt = getModuleInfo(packageName.getModuleSignature());
if (!moduleInfoOpt.isPresent()) {
throw new ResolveException("ModuleDescriptor not available.");
throw new IllegalStateException("ModuleDescriptor not available.");

Check warning on line 120 in sootup.java.core/src/main/java/sootup/java/core/views/JavaModuleView.java

View check run for this annotation

Codecov / codecov/patch

sootup.java.core/src/main/java/sootup/java/core/views/JavaModuleView.java#L120

Added line #L120 was not covered by tests
}
JavaModuleInfo moduleInfo = moduleInfoOpt.get();

Expand Down

0 comments on commit dcc2ac5

Please sign in to comment.