package hudson.plugins.checkstyle;

import hudson.Launcher;
import hudson.matrix.MatrixRun;
import hudson.matrix.MatrixBuild;
import hudson.model.Action;
import hudson.model.BuildListener;
import hudson.plugins.analysis.core.AnnotationsAggregator;
import hudson.plugins.analysis.core.HealthDescriptor;
import hudson.plugins.analysis.core.ParserResult;

/**
 * Aggregates {@link CheckStyleResultAction}s of {@link MatrixRun}s into
 * {@link MatrixBuild}.
 *
 * @author Ulli Hafner
 */

public class CheckStyleAnnotationsAggregator extends AnnotationsAggregator {
    /**
     * Creates a new instance of {@link CheckStyleAnnotationsAggregator}.
     *
     * @param build
     *            the matrix build
     * @param launcher
     *            the launcher
     * @param listener
     *            the build listener
     * @param healthDescriptor
     *            health descriptor
     * @param defaultEncoding
     *            the default encoding to be used when reading and parsing files
     */
    public CheckStyleAnnotationsAggregator(final MatrixBuild build, final Launcher launcher,
            final BuildListener listener, final HealthDescriptor healthDescriptor, final String defaultEncoding) {
        super(build, launcher, listener, healthDescriptor, defaultEncoding);
    }

    /** {@inheritDoc} */
    @Override
    protected Action createAction(final HealthDescriptor healthDescriptor, final String defaultEncoding, final ParserResult aggregatedResult) {
        return new CheckStyleResultAction(build, healthDescriptor,
                new CheckStyleResult(build, defaultEncoding, aggregatedResult));
    }

    /** {@inheritDoc} */
    @Override
    protected CheckStyleResult getResult(final MatrixRun run) {
        return run.getAction(CheckStyleResultAction.class).getResult();
    }
}


@@ -1633,36 +1633,126 @@
  %7D%0A%0A    
-/** %7B@inheritDoc%7D */
+@Override%0A    protected boolean hasResult(final MatrixRun run) %7B%0A        return getAction(run) != null;%0A    %7D%0A
 %0A    @Ov
@@ -1841,12 +1841,8 @@
 urn 
-run.
 getA
@@ -1847,16 +1847,138 @@
 tAction(
+run).getResult();%0A    %7D%0A%0A    private CheckStyleResultAction getAction(final MatrixRun run) %7B%0A        return run.getAction(
 CheckSty
@@ -1997,28 +1997,16 @@
 on.class
-).getResult(
 );%0A    %7D

Upgrade to snapshot version of analysis-core and analysis-pom. Fixed NPE for matrix jobs if there is no result to aggregate.