src/share/classes/com/sun/tools/javac/processing/JavacFiler.java

changeset 1092
826ae6a2f27d
parent 798
4868a36f6fd8
child 2525
2eb010b6cb22
equal deleted inserted replaced
1091:a6e2c1840ea1 1092:826ae6a2f27d
1 /* 1 /*
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
453 checkName(strPkg); 453 checkName(strPkg);
454 454
455 // TODO: Only support reading resources in selected output 455 // TODO: Only support reading resources in selected output
456 // locations? Only allow reading of non-source, non-class 456 // locations? Only allow reading of non-source, non-class
457 // files from the supported input locations? 457 // files from the supported input locations?
458 FileObject fileObject = fileManager.getFileForInput(location, 458
459 // In the following, getFileForInput is the "obvious" method
460 // to use, but it does not have the "obvious" semantics for
461 // SOURCE_OUTPUT and CLASS_OUTPUT. Conversely, getFileForOutput
462 // does not have the correct semantics for any "path" location
463 // with more than one component. So, for now, we use a hybrid
464 // invocation.
465 FileObject fileObject;
466 if (location.isOutputLocation()) {
467 fileObject = fileManager.getFileForOutput(location,
468 pkg.toString(),
469 relativeName.toString(),
470 null);
471 } else {
472 fileObject = fileManager.getFileForInput(location,
459 pkg.toString(), 473 pkg.toString(),
460 relativeName.toString()); 474 relativeName.toString());
475 }
461 if (fileObject == null) { 476 if (fileObject == null) {
462 String name = (pkg.length() == 0) 477 String name = (pkg.length() == 0)
463 ? relativeName.toString() : (pkg + "/" + relativeName); 478 ? relativeName.toString() : (pkg + "/" + relativeName);
464 throw new FileNotFoundException(name); 479 throw new FileNotFoundException(name);
465 } 480 }

mercurial