This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mutual require bug when compiling?


On 08/10/2009 09:29 AM, alex mitchell wrote:
Unfortunately, the duplicate definition warnings are still showing up in our
main project. I've tried putting in some print statements in ModuleManager
and ModuleInfo, and it seems that the modules are NOT being instantiated
more than once - the second time a require is encountered for the same
module, it successfully retrieves the ModuleInfo. It also seems that it is
always using findWithSourcePath, so I don't think its mistakenly
mis-identifying modules. Despite this, ImportDefinitions in require.java is
still calling ScopeExp.duplicateDefinitionError when the second require is
encountered. Perhaps the code in ImportDefinitions is mistakenly thinking
that the definitions are from a different module, even though they are from
the same module required in a different file?

I just checked in a potential fix. Please try it.


The problem was the checkCurrent method of ModuleInfo.  It has a
heuristic to not check if the module is current if we've done so
recently.  Where "recently" is 1000 ms.  But if compilation is
taking more than 1000 ms then we go down the "slow" path were
we actually try to load the class file, which fails, so we
decide the (non-existing) class is current, so we re-parse it.
And so we get a fresh set of declarations and thus duplicates.

Instead we should realize we're already compiling this module,
so don't bother checking timestamps.
--
	--Per Bothner
per@bothner.com   http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]