diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/AbstractApplication.java b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/AbstractApplication.java index c30544d512..52e22d35dc 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/AbstractApplication.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/AbstractApplication.java @@ -277,11 +277,19 @@ public IArtifactRepository getCompositeArtifactRepository() { } public boolean hasArtifactSources() { - return ((ICompositeRepository) getCompositeArtifactRepository()).getChildren().size() > 0; + IArtifactRepository repository = getCompositeArtifactRepository(); + if (repository instanceof ICompositeRepository composite) { + return composite.getChildren().size() > 0; + } + return false; } public boolean hasMetadataSources() { - return ((ICompositeRepository) getCompositeMetadataRepository()).getChildren().size() > 0; + IMetadataRepository repository = getCompositeMetadataRepository(); + if (repository instanceof ICompositeRepository composite) { + return composite.getChildren().size() > 0; + } + return false; } public abstract IStatus run(IProgressMonitor monitor) throws ProvisionException;