Skip to content

Instantly share code, notes, and snippets.

View neomatrix369's full-sized avatar
🎯
Focusing

mani neomatrix369

🎯
Focusing
View GitHub Profile
@neomatrix369
neomatrix369 / CanSubclassChecker.java
Created December 27, 2012 13:14
Changed logic behind how CanSubclassChecker checks for mutability in src/main/java/org/mutabilitydetector/checkers/CanSubclassChecker.java b/src/main/java/org/mutabilitydetector/checkers/CanSubclassChecker.java
diff --git a/src/main/java/org/mutabilitydetector/checkers/CanSubclassChecker.java b/src/main/java/org/mutabilitydetector/checkers/CanSubclassChecker.java
index 947cd5e..c8baaf2 100644
--- a/src/main/java/org/mutabilitydetector/checkers/CanSubclassChecker.java
+++ b/src/main/java/org/mutabilitydetector/checkers/CanSubclassChecker.java
@@ -39,7 +39,7 @@ public final class CanSubclassChecker extends AbstractMutabilityChecker {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
- if (MethodIs.aConstructor(name) && method(access).isNotPrivate()) {
+ if (MethodIs.aConstructor(name) && (method(access).isNotPrivate()) && method(access).isNotSynthetic()) {
@neomatrix369
neomatrix369 / AccessModifierQuery.java
Created December 27, 2012 13:15
Added a new Opcode called ACC_SYNTHETIC in /src/main/java/org/mutabilitydetector/checkers/AccessModifierQuery.java
diff --git a/src/main/java/org/mutabilitydetector/checkers/AccessModifierQuery.java b/src/main/java/org/mutabilitydetector/checkers/AccessModifierQuery.java
index 111001b..b92fed0 100644
--- a/src/main/java/org/mutabilitydetector/checkers/AccessModifierQuery.java
+++ b/src/main/java/org/mutabilitydetector/checkers/AccessModifierQuery.java
@@ -22,6 +22,7 @@ import static org.objectweb.asm.Opcodes.ACC_FINAL;
import static org.objectweb.asm.Opcodes.ACC_INTERFACE;
import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_STATIC;
+import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC;
@neomatrix369
neomatrix369 / CanSubclassCheckerTest.java
Created December 27, 2012 13:18
Added a test and extended CanSubclassCheckerTest in src/test/java/org/mutabilitydetector/benchmarks/CanSubclassCheckerTest.java b/src/test/java/org/mutabilitydetector/benchmarks/CanSubclassCheckerTest.java
diff --git a/src/test/java/org/mutabilitydetector/benchmarks/CanSubclassCheckerTest.java b/src/test/java/org/mutabilitydetector/benchmarks/CanSubclassCheckerTest.java
index 988c019..bd99158 100644
--- a/src/test/java/org/mutabilitydetector/benchmarks/CanSubclassCheckerTest.java
+++ b/src/test/java/org/mutabilitydetector/benchmarks/CanSubclassCheckerTest.java
@@ -42,6 +42,7 @@ import org.mutabilitydetector.benchmarks.sealed.SealedImmutable;
import org.mutabilitydetector.benchmarks.types.EnumType;
import org.mutabilitydetector.checkers.CanSubclassChecker;
import org.mutabilitydetector.locations.ClassLocation;
+import org.mutabilitydetector.unittesting.MutabilityAssert;
@neomatrix369
neomatrix369 / ImmutableByHavingOnlyAPrivateConstructorUsingTheBuilderPattern.java
Created December 27, 2012 13:34
New example class created - src\test\benchmarks\org\mutabilitydetector\benchmarks\ImmutableByHavingOnlyAPrivateConstructorUsingTheBuilderPattern.java
package org.mutabilitydetector.benchmarks;
public class ImmutableByHavingOnlyAPrivateConstructorUsingTheBuilderPattern {
private final String field;
// usual method of making a class immutable
// - make its constructor private: ref EffectiveJava
private ImmutableByHavingOnlyAPrivateConstructorUsingTheBuilderPattern (String field) {
this.field = field;
}
@neomatrix369
neomatrix369 / gist:4420590
Created December 31, 2012 15:15
Mutability Detector maven build issue (maven plugin version issue) - although error message does not mention this clearly!
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building MutabilityDetector
[INFO] task-segment: [clean, package]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin descriptor for the plugin Plugin [org.apache.maven.plugins:maven-compiler-plugin] was not found. Please verify that the plugin JAR C:\Users\User\.m2\repository\org\apache\maven\plugins\maven-compiler-plugin\2.0.2\maven-compiler-plugin-2.0.2.jar is intact.
[INFO] ------------------------------------------------------------------------
@neomatrix369
neomatrix369 / gist:4420898
Last active December 10, 2015 10:28
MutabilityDetector maven build failure due to multiple test failures!
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MutabilityDetector 0.9-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-shade-plugin/1.4/maven-shade-plugin-1.4.pom
Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-shade-plugin/1.4/maven-shade-plugin-1.4.pom (6 KB at 19.3 KB/sec)
@neomatrix369
neomatrix369 / gist:4421870
Created December 31, 2012 18:31
MutabilityDetector maven build failure due to one test failure!
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MutabilityDetector 0.9-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.mutabilitydetector:asm-nonclassloadingsimpleverifier:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO]
@neomatrix369
neomatrix369 / org.mutabilitydetector.unittesting.matchers.reasons.WithAllowedReasonsMatcherTest.txt
Last active December 10, 2015 11:28
Test set: org.mutabilitydetector.unittesting.matchers.reasons.WithAllowedReasonsMatcherTest (maven build failure log)
-------------------------------------------------------------------------------
Test set: org.mutabilitydetector.unittesting.matchers.reasons.WithAllowedReasonsMatcherTest
-------------------------------------------------------------------------------
Tests run: 8, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.017 sec <<< FAILURE!
mismatchDescriptionExplicitlyStatesNoReasonsHaveBeenAllowed(org.mutabilitydetector.unittesting.matchers.reasons.WithAllowedReasonsMatcherTest) Time elapsed: 0.017 sec <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException: 5
at org.mutabilitydetector.unittesting.matchers.reasons.WithAllowedReasonsMatcherTest.mismatchDescriptionExplicitlyStatesNoReasonsHaveBeenAllowed(WithAllowedReasonsMatcherTest.java:169)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Books on Richard Feynman!
=========================
Surely You're Joking, Mr. Feynman! (Adventures of a Curious ... -
http://buffman.net/ebooks/Richard_P_Feynman-Surely_Youre_Joking_Mr_Feynman_v5.pdf
What.Do.You.Care.What.Other.People.Think
http://www.cypherpunk.cz/books/Richard.Feynman.-.What.Do.You.Care.What.Other.People.Think.-.challenger.investigation.pdf
@neomatrix369
neomatrix369 / gist:5263473
Last active December 15, 2015 12:58
Azul's GC, GC book and other GC articles
Both the Azul concurrent collector and Compressor are described in our recent book: "The Garbage Collection Handbook", coauthored with Richard Jones and Eliot Moss.
GC Papers: http://dl.acm.org/citation.cfm?id=1993491&dl=ACM&coll=DL&CFID=197266941&CFTOKEN=89353319
http://dl.acm.org/citation.cfm?id=1346281.1346294&coll=DL&dl=GUIDE
Article: http://www.artima.com/lejava/articles/azul_pauseless_gc.html
Plus more on Pauseless and Zing at http://www.azulsystems.com/products/zing/c4-java-garbage-collector-wp.