[GRADLE-1735] ClassCastException: DefaultFileSnapshotter$FileCollectionSnapshotImpl cannot be cast to OutputFilesSnapshotter$OutputFilesSnapshot Created: 08/Aug/11  Updated: 04/Jan/13  Resolved: 12/Aug/11

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-4
Fix Version/s: None

Type: Bug
Reporter: Evgeny Goldin Assignee: Unassigned
Resolution: Duplicate Votes: 0

Attachments: Zip Archive gradle-debug.zip    
Issue Links:
Duplicate
Duplicates GRADLE-1472 java.lang.ClassCastException FileColl... Resolved

 Description   

When running this build with simply "gradle" I receive the following exception:

#[01:31:40][~/Projects/gcommons]$ gradle
:clean
:codenarc
log4j:WARN No appenders could be found for logger (org.codenarc.ant.CodeNarcTask).
log4j:WARN Please initialize the log4j system properly.
CodeNarc completed: (p1=0; p2=105; p3=230) 13337ms
:compileJava UP-TO-DATE
:compileGroovy

FAILURE: Build aborted because of an internal error.

* What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://www.gradle.org.

* Try:
Run with --debug option to get additional debug info.

* Exception is:
java.lang.ClassCastException: org.gradle.api.internal.changedetection.DefaultFileSnapshotter$FileCollectionSnapshotImpl cannot be cast to org.gradle.api.internal.changedetection.OutputFilesSnapshotter$OutputFilesSnapshot
	at org.gradle.api.internal.changedetection.OutputFilesSnapshotter$OutputFilesSnapshot.changesSince(OutputFilesSnapshotter.java:96)
	at org.gradle.api.internal.changedetection.OutputFilesChangedUpToDateRule$1.checkUpToDate(OutputFilesChangedUpToDateRule.java:43)
	at org.gradle.api.internal.changedetection.CompositeUpToDateRule$1.checkUpToDate(CompositeUpToDateRule.java:41)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$HistoricExecution.isUpToDate(DefaultTaskArtifactStateRepository.java:122)
	at org.gradle.api.internal.changedetection.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(DefaultTaskArtifactStateRepository.java:154)
	at org.gradle.api.internal.changedetection.ShortCircuitTaskArtifactStateRepository$1.isUpToDate(ShortCircuitTaskArtifactStateRepository.java:35)
	at org.gradle.api.internal.changedetection.FileCacheBroadcastTaskArtifactStateRepository$1.isUpToDate(FileCacheBroadcastTaskArtifactStateRepository.java:37)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:44)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:41)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
	at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:237)
	at org.gradle.execution.DefaultTaskGraphExecuter.executeTask(DefaultTaskGraphExecuter.java:167)
	at org.gradle.execution.DefaultTaskGraphExecuter.doExecute(DefaultTaskGraphExecuter.java:160)
	at org.gradle.execution.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:78)
	at org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:113)
	at org.gradle.execution.DelegatingBuildExecuter.execute(DelegatingBuildExecuter.java:54)
	at org.gradle.execution.DelegatingBuildExecuter.execute(DelegatingBuildExecuter.java:54)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:155)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:109)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:77)
	at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:41)
	at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:27)
	at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
	at org.gradle.launcher.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
	at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:219)
	at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:203)
	at org.gradle.launcher.Main.execute(Main.java:55)
	at org.gradle.launcher.Main.main(Main.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:49)
	at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:31)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:24)


BUILD FAILED

Total time: 1 mins 2.6 secs
#[01:33:58][~/Projects/gcommons]$ 


 Comments   
Comment by Evgeny Goldin [ 08/Aug/11 ]

Output of "gradle -S --debug > gradle-debug.txt 2>&1" is attached.

Comment by Evgeny Goldin [ 08/Aug/11 ]

Hmm, I see there's no stack trace in debug mode. Can it be the case that "--debug" mode disables it accidentally?

Comment by Evgeny Goldin [ 08/Aug/11 ]
#[01:55:26][~/Projects/gcommons]$ gradle -version

------------------------------------------------------------
Gradle 1.0-milestone-4
------------------------------------------------------------

Gradle build time: Thursday, July 28, 2011 11:38:22 AM IDT
Groovy: 1.7.10
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_26 (Apple Inc. 20.1-b02-383)
OS: Mac OS X 10.7 x86_64

#[01:55:32][~/Projects/gcommons]$ 
Comment by Peter Niederwieser [ 12/Aug/11 ]

gcommons build succeeds for me, don't get this exception.

Comment by Evgeny Goldin [ 12/Aug/11 ]

Hi, It surely threw this exception each time I ran it but may be it's an issue that is fixed already. Did you try it with m4 that was released and then removed from the site or some later Gradle build? I can try building it on a Windows machine to see if it happens there.

Comment by Evgeny Goldin [ 12/Aug/11 ]

I could also see in the debugger how two different implementations of the same interface were casted one into another.

Comment by Peter Niederwieser [ 14/Aug/11 ]

I tried with M4 as released and Mac OS. But other people have reported this problem too, so I marked it as a duplicate.

Generated at Wed Jun 30 12:03:02 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.