Skip to content

Instantly share code, notes, and snippets.

View marchof's full-sized avatar
💭
🧑‍💻 ^ 🏔

Marc R. Hoffmann marchof

💭
🧑‍💻 ^ 🏔
View GitHub Profile
@marchof
marchof / readme.md
Last active April 17, 2019 05:21
Java 11 Workshop
/*******************************************************************************
* Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
@marchof
marchof / ControlStructuresTest.java
Created August 2, 2018 15:14
Proposal for new validation test setup for JaCoCo
/*******************************************************************************
* Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Marc R. Hoffmann - initial API and implementation
*
@marchof
marchof / FinallyFilter.java
Created October 6, 2017 07:01
FinallyFilter without inner class Matcher
/*******************************************************************************
* Copyright (c) 2009, 2017 Mountainminds GmbH & Co. KG and Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
@marchof
marchof / Filters.java
Last active September 28, 2017 22:18
Alternative implementation for class Filters
/*******************************************************************************
* Copyright (c) 2009, 2017 Mountainminds GmbH & Co. KG and Contributors
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Evgeny Mandrikov - initial API and implementation
*
@marchof
marchof / details.txt
Created September 20, 2017 17:54
BugReport for ASM: AnalyzerAdapter calculates wrong type for AALOAD in case of Null
According to JVMS Chapter "4.10.1.9 Type Checking Instructions, AALOAD", the resulting type on the operand stack is
1) the component type if the input type is an array
2) or null if the input type is null
This is how the JVM verifier is implemented -- even if the latter will always lead to a NPE at runtime.
AnalyzerAdapter handles the second case wrong.
STEPS TO REPRODUCE
@marchof
marchof / ExecFix.java
Created August 24, 2017 14:15
Fixing truncated JaCoCo exec files
package org.jacoco.examples;
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import org.jacoco.core.tools.ExecFileLoader;
/**
* Loads whatever is available in a truncated JaCoCo exec file and writes it to
@marchof
marchof / TestCopperPathManagerMove.casm
Created August 17, 2017 12:36
Decompiled TestCopperPathManagerMove.class
static {};
descriptor: ()V
flags: ACC_STATIC
Code:
stack=2, locals=5, args_size=0
0: invokestatic #948 // Method ajc$preClinit:()V
3: ldc_w #744 // String com.nokia.lni.coverage.TestCopperPathManagerMove
6: invokestatic #770 // Method com/nokia/lni/aspect/trace/SimpleGetterAspect.ajc$createAspectInstance:(Ljava/lang/String;)Lcom/nokia/lni/aspect/trace/SimpleGetterAspect;
9: putstatic #710 // Field ajc$com_nokia_lni_aspect_trace_SimpleGetterAspect$ptwAspectInstance:Lcom/nokia/lni/aspect/trace/SimpleGetterAspect;
12: ldc_w #744 // String com.nokia.lni.coverage.TestCopperPathManagerMove
@marchof
marchof / BaseEntityManager-instr.asm
Created July 27, 2017 16:03
Potential JaCoCo instrumentation problem
This file has been truncated, but you can view the full file.
Classfile /D:/temp/classfile-analysis/BaseEntityManager-instr.class
Last modified 27.07.2017; size 95561 bytes
MD5 checksum 28d106a70d01a4dcafcebcbfac711359
Compiled from "BaseEntityManager.java"
public abstract class weblogic.ejb.container.manager.BaseEntityManager extends weblogic.ejb.container.manager.BaseEJBManager implements weblogic.ejb.container.interfaces.CachingManager
minor version: 0
major version: 51
flags: ACC_PUBLIC, ACC_SUPER, ACC_ABSTRACT
Constant pool:
#1 = Utf8 weblogic/ejb/container/manager/BaseEntityManager
@marchof
marchof / ManyOverloadedMethods.java
Created February 27, 2017 08:59
EclEmma Performance Issue with many overloaded methods.
public class ManyOverloadedMethods {
class X {}
class Y {}
void m(Y a, Y b, Y c, Y d, Y e, Y f, Y g, Y h, Y i, Y j, Y k) {}
void m(X a, Y b, Y c, Y d, Y e, Y f, Y g, Y h, Y i, Y j, Y k) {}
void m(Y a, X b, Y c, Y d, Y e, Y f, Y g, Y h, Y i, Y j, Y k) {}
void m(X a, X b, Y c, Y d, Y e, Y f, Y g, Y h, Y i, Y j, Y k) {}
void m(Y a, Y b, X c, Y d, Y e, Y f, Y g, Y h, Y i, Y j, Y k) {}
void m(X a, Y b, X c, Y d, Y e, Y f, Y g, Y h, Y i, Y j, Y k) {}
void m(Y a, X b, X c, Y d, Y e, Y f, Y g, Y h, Y i, Y j, Y k) {}