Changeset 3289
- Timestamp:
- 01/05/09 12:04:20 (10 months ago)
- Location:
- trunk/ProjectFortress
- Files:
-
- 1 added
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/ProjectFortress/src/com/sun/fortress/compiler/disambiguator/TypeDisambiguator.java
r3246 r3289 1 1 /******************************************************************************* 2 Copyright 200 8Sun Microsystems, Inc.,2 Copyright 2009 Sun Microsystems, Inc., 3 3 4150 Network Circle, Santa Clara, California 95054, U.S.A. 4 4 All rights reserved. … … 303 303 Option<APIName> realApiOpt = _env.apiName(originalApi); 304 304 if (realApiOpt.isNone()) { 305 // retry for debugging purposes 306 realApiOpt = _env.apiName(originalApi); 305 307 error("Undefined API: " + NodeUtil.nameString(originalApi), originalApi); 306 308 return that; -
trunk/ProjectFortress/src/com/sun/fortress/repository/ForeignJava.java
r3288 r3289 64 64 public class ForeignJava { 65 65 66 /** given an API Name, what Java classes does it import? ( Name of existing67 * Java class, not its wrapper.)66 /** given an API Name, what Java classes does it import? (Existing 67 * Java class, not its compiled Fortress wrapper class.) 68 68 */ 69 69 MultiMap<APIName, Class> javaImplementedAPIs = new MultiMap<APIName, Class>(); … … 263 263 generatedImports.putItem(importing_package, api_name); 264 264 265 /* 266 * Ensure that the API and class appear. 267 */ 268 javaImplementedAPIs.putItem(api_name,imported_class); 269 265 270 Id name = NodeFactory.makeId(span, imported_class.getSimpleName()); 266 271 … … 396 401 Set<APIName> gi = generatedImports.get(name); 397 402 if (gi != null) 398 for (APIName a : gi) { 399 AliasedAPIName aan = NodeFactory.makeAliasedAPIName(a); 400 /* 401 * Hoping to lie, slightly, to static analysis. This is 402 * technically speaking a "foreign" import, but the import is 403 * already known to the ForeignJava data structures, and this 404 * allows use of fully qualified (hence unambiguous) references 405 * to classes from other packages in the generated API. 406 * 407 * So, one lie -- no foreign annotation. 408 */ 409 ImportApi iapi = NodeFactory.makeImportApi(span, Option 410 .<String> none(), Useful.list(aan)); 411 imports.add(iapi); 412 } 413 403 for (APIName a : gi) { 404 importAnApi(imports, a); 405 } 406 // Implicitly import. 407 importAnApi(imports, NodeFactory.makeAPIName(span, "FortressLibrary")); 408 414 409 List<Decl> decls = new ArrayList<Decl>(); 415 410 for (Decl d : apiToStaticDecls.get(name)) { … … 422 417 } 423 418 return result; 424 419 420 } 421 422 private void importAnApi(List<Import> imports, APIName a) { 423 AliasedAPIName aan = NodeFactory.makeAliasedAPIName(a); 424 /* 425 * Hoping to lie, slightly, to static analysis. This is 426 * technically speaking a "foreign" import, but the import 427 * is already known to the ForeignJava data structures, and 428 * this allows use of fully qualified (hence unambiguous) 429 * references to classes from other packages in the 430 * generated API. 431 * 432 * So, one lie -- no foreign annotation. 433 */ 434 ImportApi iapi = NodeFactory.makeImportApi(span, Option 435 .<String> none(), Useful.list(aan)); 436 imports.add(iapi); 425 437 } 426 438 -
trunk/ProjectFortress/src/com/sun/fortress/repository/GraphRepository.java
r3288 r3289 460 460 @Override 461 461 public Boolean apply(GraphNode g){ 462 return g instanceof ApiGraphNode && staleOrDependsOnStale.get(g); 462 return g instanceof ApiGraphNode && (staleOrDependsOnStale.get(g) || 463 // TODO need to fix the whole date-stamp thing for APIs. 464 foreignJava.definesApi(((ApiGraphNode)g).getName()) 465 ); 463 466 } 464 467 }; … … 628 631 try{ 629 632 APIName api_name = node.getName(); 630 File fdot = findFile(api_name, ProjectProperties.API_SOURCE_SUFFIX); 631 CompilationUnit api = Parser.parseFileConvertExn(fdot); 632 if (api instanceof Api) { 633 return (Api) api; 633 if (foreignJava.definesApi(api_name)) { 634 return (Api) foreignJava.fakeApi(api_name).ast(); 634 635 } else { 635 throw StaticError.make("Unexpected parse of API " + api_name, ""); 636 File fdot = findFile(api_name, ProjectProperties.API_SOURCE_SUFFIX); 637 CompilationUnit api = Parser.parseFileConvertExn(fdot); 638 if (api instanceof Api) { 639 return (Api) api; 640 } else { 641 throw StaticError.make("Unexpected parse of API " + api_name, ""); 642 } 636 643 } 637 644 } catch ( FileNotFoundException e ){

