Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-dev] IAccessRules on transitive exports
  • From: Jayaprakash Arthanareeswaran <jarthana@xxxxxxxxxx>
  • Date: Thu, 27 Jan 2022 04:53:27 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ypQI0tGvLRKQwWWyr8tWriwim2uGHje7LS3kEJ4R2MQ=; b=XpaNW7zleg0qlvcE/nELN1e01dXWibPBQJLmo2hyUS3U4JjwfZ6dxUSLE4cVf1cQfJf4YbQQz3ap0jVLNjAB75tWD40ZvomwjELlL2yvm79iVPB0atsYJMTlDQh9JCBFYhAKhI9bco9fPwuT8lHo5keO+VsgxzUP2/JekLV5zJ8/YYu6PWCrkwlazz3vaHm9GlqX6FUX8UUm2zEom//9FKUEpL9n/vQBAxlopvABwgpyLsfmnZsT6uthrBXZSYFJu/mgX4z+cs0CxzzoNQx2nErSCHQVntteAQuNh7JSm7gmXFw+z9OqyfevcZInyjIR+OXaxGIM7tx2GUM2S3tUeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=foFIcn7rjklDldQk7ANFR6q7Nm4w0Ujh9kbggwMQpiEmepmzn8Ec6Qy1lRlpv/aYOtg9fTR+922UN7PSIJfvwf94vHQJEGwtzrKlUqH+wzkMy22kuqZom5EFyKA/m9v/mWmF/0UzEqV+svW8ckb2MKd3QFQicaYN9pzMUn9S0xsiIg9DrjN1MKZstQLfjJsYo1Ae71FFRL1LgxbBSoDtrCVdDtTBdJzMdvfQVW2rBeYWFAwRlvM0HEsWcu/i24gDIkWFGgVZIhPLsOH6DG31L79Emg/gHvygG83KD0UQMPgv7rOeGJAoFRlBCjN+cbjH+vEatxndoAtc/QZLsN8KyA==
  • Delivered-to: jdt-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jdt-dev/>
  • List-help: <mailto:jdt-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jdt-dev>, <mailto:jdt-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jdt-dev>, <mailto:jdt-dev-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHYEq0H6MsGiQT6WEexYgzM/KSrXax2SzXw
  • Thread-topic: IAccessRules on transitive exports

I am not an expert in this area, but I don’t see a lot of code in jdt.core around IGNORE_IF_BETTER,

T just some code in ClasspathEntry that encodes and decodes this value and nothing much.

 

This could be a bug IMO, unless someone can point otherwise. Can you raise a bug so we can

understand this further and work on it?

 

Regards,

Jay

 

From: jdt-dev <jdt-dev-bounces@xxxxxxxxxxx> On Behalf Of Fr Jeremy Krieg
Sent: 26 January 2022 17:40
To: jdt-dev@xxxxxxxxxxx
Subject: [EXTERNAL] [jdt-dev] IAccessRules on transitive exports

 

Hi team, I pray that you are all well. Executive Summary: I'm having trouble with a custom classpath container that implements access rules on a transitive dependency. The dependency transitively included via two separate projects. Each of ZjQcmQRYFpfptBannerStart

This Message Is From an External Sender

This message came from outside your organization.

ZjQcmQRYFpfptBannerEnd

Hi team,

 

I pray that you are all well.

 

Executive Summary:

I'm having trouble with a custom classpath container that implements access rules on a transitive dependency. The dependency transitively included via two separate projects. Each of those projects has different access rules, and despite the fact that I'm specifying K_IGNORE_IF_BETTER, it seems that the access rules of the first get applied to the transitive dependency and the second's get ignored (even if they are "better" = more accessible).

 

Detail: 

My workspace has:

 

A jar library osgi.core, which has a set of public packages;

Project A, which has osgi.core as its sole dependency, and no classes of its own, but embeds package org.osgi.framework as part of its public API and org.osgi.util.tracker as a non-public package.

Project B, which also has osgi.core as a dependency, but which doesn't embed any packages from it.

 

What I want is for the osgi.core library to be made visible to transitive dependencies, but only the relevant subset of packages that is referenced by the "in-transit" project. Ie, suppose project D has only project A on its build path -  it should be able to see package org.osgi.framework without warnings, org.osgi.util.tracker with warnings, and all other packages of osgi.core should generate errors. Likewise, if it has project B on its build path, it shouldn't be able to see any of the packages of osgi.core without generating an error.

 

I have implemented a scheme that works fine using Eclipse 2020-06:

 

-Project A's custom container adds osgi.core using JavaCore.newLibraryEntry(), with the export flag set to "true". Likewise for project B.

-When Project D has Project A as the sole entry on its build path, the container adds it using JavaCore.newProjectEntry(), export set to "true", combine access rules set to "true", org.osgi.framework with an IAccessRule of K_ACCESSIBLE, org.osgi.util.tracker with K_DISCOURAGED | K_IGNORE_IF_BETTER, and a final default rule of "**" with K_NON_ACCESSIBLE | K_IGNORE_IF_BETTER. This produces the expected result - classes in project D can see classes in org.osgi.framework without warning, can see org.osgi.util.tracker with a warning, and an attempt to access any other package in osgi.core generates an error.

-Likewise, when Project D has Project A as the sole entry, the container adds it with JavaCore.newProjectEntry(), export true, combine rules true, and a single default rule of "**" with K_NON_ACCESSIBLE | K_IGNORE_IF_BETTER. This too works as expected.

 

What is not expected is when I try to add both project A and B to the build path at the same time. In this case, instead of the visibility into the transitive dependency osgi.core being determined by the most lenient access rules (which is what I understood "IGNORE_IF_BETTER" to mean), it is determined by the access rules of whichever dependency appears first on the build path. Ie, if project A comes first, the classes of project D can see org.osgi.framework and (with a warning) org.osgi.util.tracker - however, if project B comes first on the build path, then none of the org.osgi packages is osgi.core are visible to project D.

Am I missing something here? Have I misconfigured it? Does IGNORE_IF_BETTER not work the way that I expect it? Or is there a bug?

 

Any light that anyone could shed on this would be much appreciated.

 

Blessings, 

logo-blue (version 2 cut out)Fr Jeremy Krieg

Chief Executive Officer

 

Greek Welfare Centre SA

St Philothei

Greek Orthodox Archdiocese of Australia

 

213 Henley Beach Road

TORRENSVILLE SA 5031

Phone: (08) 8212 5100

manager@xxxxxxxxxxxxxxxxxxxxx

www.greekwelfaresa.org.au

 


Back to the top