Couple<String> (String path, String packageName) { while (path.startsWith("../")) { if (packageName.isEmpty()) return null; int dotPos = packageName.lastIndexOf('.'); packageName = dotPos < 0 ? "" : packageName.substring(0, dotPos); path = path.substring(3); } return Couple.of(path, packageName); }