Skip to content

Commit

Permalink
[Truffle] Move off deprecated source API.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Jan 12, 2017
1 parent 5c4ecb5 commit 36eb463
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -14,6 +14,7 @@
package org.jruby.truffle.language.loader;

import com.oracle.truffle.api.source.Source;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.aot.RootedFileVisitor;
import org.jruby.truffle.aot.SimpleRootedFileVisitor;

Expand Down Expand Up @@ -78,7 +79,6 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
return coreLibraryFiles;
}

@SuppressWarnings("deprecation")
private static Map<String, CoreLibraryFile> getCoreLibrary() {
Map<String, CoreLibraryFile> coreLibrary = new HashMap<>();
Set<String> coreLibraryFiles = getCoreLibraryFiles();
Expand All @@ -87,7 +87,7 @@ private static Map<String, CoreLibraryFile> getCoreLibrary() {
Path filePath = jarFileSystem.getPath("/" + name);
try (Reader reader = Files.newBufferedReader(filePath)) {
if (reader != null) {
Source source = Source.fromReader(reader, name);
Source source = Source.newBuilder(reader).name(name).mimeType(RubyLanguage.MIME_TYPE).build();

byte[] code = source.getCode().getBytes(StandardCharsets.UTF_8);
coreLibrary.put(name, new CoreLibraryFile(code, null));
Expand Down

0 comments on commit 36eb463

Please sign in to comment.